@@ -58,18 +58,25 @@ def run
5858      def  clean_local ( branch ) 
5959        out  2 ,  "#{ branch }  :" 
6060        tip_hash  =  Git . command  'rev-parse' ,  [ branch ] 
61+ 
6162        # commits older than and including cutoff 
6263        old_log  =  Git . command  'log' ,  [ min_age ,  '--format=raw' ,  branch ] 
64+         old_log_entries  =  old_log . split  /(?=commit [0-9a-f]{40})/    # Lookahead assertions FTW 
65+ 
6366        # commits newer than and including cutoff 
6467        new_log  =  Git . command  'log' ,  [ max_age ,  '--format=raw' ,  branch ] 
68+         new_log_entries  =  new_log . split  /(?=commit [0-9a-f]{40})/ 
69+ 
70+         # If the cutoff time is the same as one of the commit times, this 
71+         # commit will be in both new_log_entries and old_log_entries. So 
72+         # make sure it's only in one. 
73+         new_log_entries . pop  if  new_log_entries . last  == old_log_entries . first 
6574
66-         if  old_log . empty? 
75+         if  old_log_entries . empty? 
6776          out  :detail ,  2 ,  "No commits prior to cutoff date. Skipping." 
68-         elsif  new_log . empty? 
77+         elsif  new_log_entries . empty? 
6978          out  :detail ,  2 ,  "No commits after cutoff date. Skipping." 
7079        else 
71-           old_log_entries  =  old_log . split  /(?=commit [0-9a-f]{40})/    # Lookahead assertions FTW 
72-           new_log_entries  =  new_log . split  /(?=commit [0-9a-f]{40})/ 
7380          build_commit_map ( branch )  if  replace 
7481
7582          out  :detail ,  4 ,  "Truncating #{ old_log_entries . length }   commits..." 
0 commit comments