@@ -79,24 +79,32 @@ def branch_tree(config: Dict[str, Union[str, int]]) -> None:
7979        print ("No data available." )
8080
8181
82- def  branches_by_date () ->  None :
82+ def  branches_by_date (config :  Dict [ str ,  Union [ str ,  int ]] ) ->  None :
8383    """ 
8484    Lists branches sorted by the latest commit date. 
8585
8686    Args: 
87-         None  
87+         config: Dict[str, Union[str, int]]: Config dictionary holding env vars.  
8888
8989    Returns: 
9090        None 
9191    """ 
9292
93+     # Grab the config options from our config.py. 
94+     ignore_authors  =  config .get ("ignore_authors" , lambda  _s : False )
95+ 
9396    # Original command: 
9497    # git for-each-ref --sort=committerdate refs/heads/ \ 
9598    #     --format='[%(authordate:relative)] %(authorname) %(refname:short)' | cat -n 
9699    # TODO: Wouldn't git log --pretty=format:'%ad' --date=short be better here? 
97100    #       Then we could pipe it through sort, uniq -c, sort -nr, etc. 
98101    #       Possibly feed back into the parent project 
99-     format_str  =  "[%(authordate:relative)] %(authorname) %(refname:short)" 
102+ 
103+     # Include the email so we can filter based off it, but keep the visible 
104+     # part the same as before. 
105+     visible_fmt  =  "[%(authordate:relative)] %(authorname) %(refname:short)" 
106+     format_str  =  f"{ visible_fmt }  
107+ 
100108    cmd  =  [
101109        "git" ,
102110        "for-each-ref" ,
@@ -106,19 +114,35 @@ def branches_by_date() -> None:
106114    ]
107115
108116    output  =  run_git_command (cmd )
109-     if  output :
110-         # Split the output into lines 
111-         lines   =   output . split ( " \n " ) 
117+     if  not   output :
118+         print ( "No commits found." ) 
119+         return 
112120
113-         # Number the lines similar to 'cat -n' 
114-         numbered_lines  =  [f"{ idx  +  1 } { line }   for  idx , line  in  enumerate (lines )]
121+     # Split lines and filter by author (both name and email), but keep 
122+     # visible text only. 
123+     visible_lines  =  []
124+     for  raw  in  output .split ("\n " ):
125+         if  not  raw .strip ():
126+             continue 
127+         if  "|"  in  raw :
128+             visible , email  =  raw .split ("|" , 1 )
129+         else :
130+             visible , email  =  raw , "" 
115131
116-         # Output numbered lines 
117-         print ("All branches (sorted by most recent commit):\n " )
118-         for  line  in  numbered_lines :
119-             print (f"\t { line }  )
120-     else :
132+         # Filter by either email or the visible chunk. 
133+         if  ignore_authors (email ) or  ignore_authors (visible ):
134+             continue 
135+ 
136+         visible_lines .append (visible )
137+ 
138+     if  not  visible_lines :
121139        print ("No commits found." )
140+         return 
141+ 
142+     # Number like `cat -n` 
143+     print ("All branches (sorted by most recent commit):\n " )
144+     for  idx , line  in  enumerate (visible_lines , 1 ):
145+         print (f"\t { idx } { line }  )
122146
123147
124148def  contributors (config : Dict [str , Union [str , int ]]) ->  None :
@@ -213,6 +237,7 @@ def new_contributors(config: Dict[str, Union[str, int]], new_date: str) -> None:
213237    until  =  config .get ("until" , "" )
214238    log_options  =  config .get ("log_options" , "" )
215239    pathspec  =  config .get ("pathspec" , "" )
240+     ignore_authors  =  config .get ("ignore_authors" , lambda  _s : False )
216241
217242    # Original command: 
218243    # git -c log.showSignature=false log --use-mailmap $_merges \ 
@@ -245,6 +270,9 @@ def new_contributors(config: Dict[str, Union[str, int]], new_date: str) -> None:
245270            try :
246271                email , timestamp  =  line .split ("|" )
247272                timestamp  =  int (timestamp )
273+                 # Skip ignored by email 
274+                 if  ignore_authors (email ):
275+                     continue 
248276                # If the contributor is not in the dictionary or the current timestamp is earlier 
249277                if  email  not  in contributors_dict  or  timestamp  <  contributors_dict [email ]:
250278                    contributors_dict [email ] =  timestamp 
@@ -283,12 +311,14 @@ def new_contributors(config: Dict[str, Union[str, int]], new_date: str) -> None:
283311                name_cmd  =  [arg  for  arg  in  name_cmd  if  arg ]
284312
285313                # Grab name + email if we can. Otherwise, just grab email 
286-                 name  =  run_git_command (name_cmd )
287-                 if  name :
288-                     new_contributors_list .append ((name , email ))
289-                 else :
290-                     new_contributors_list .append (("" , email ))
291- 
314+                 # while also making sure to ignore any authors that may be 
315+                 # in our ignore_author env var 
316+                 name  =  (run_git_command (name_cmd ) or  "" ).strip ()
317+                 combo  =  f"{ name } { email }   if  name  else  f"<{ email }  
318+                 if  ignore_authors (email ) or  ignore_authors (name ) or  ignore_authors (combo ):
319+                     continue 
320+ 
321+                 new_contributors_list .append ((name , email ))
292322        # Sort the list alphabetically by name to match the original 
293323        # and print all of this out 
294324        if  new_contributors_list :
0 commit comments