Thread (7 messages) flat view 7 messages, 5 authors, 2016-06-15

Re: [PATCH] Add git-graft-ripple, a tool for permanently grafting history into a tree.

From: Randal L. Schwartz <hidden>
Date: 2016-06-15 22:42:13

quoted
quoted
quoted
quoted
"Ryan" == Ryan Anderson [off-list ref] writes:
Ryan> git_commit_tree():

Ryan> 	my $found;
Ryan> 	do {
Ryan> 		$found = 0;
Ryan> 		if ($csets{$old}{comments} =~ /\s([a-f0-9]{40})\s/ &&
Ryan> 			exists $newcsets{$1}) {

Ryan> 			my $tcommit = $1;

Ryan> 			$found = 1;
Ryan> 			$csets{$old}{comments} =~ s/$tcommit/$newcsets{$tcommit}/g;
Ryan> 		}
Ryan> 	} while ($found);

I hate artificial booleans.  This is better written as:

  {
    last unless my ($tcommit) = $csets{$old}{comments} =~ /\s([a-f0-9]{40})\s/;
    last unless exists $newcsets{$tcommit};
    $csets{$old}{comments} =~ s/$tcommit/$newcsets{$tcommit}/g;
    redo;
  }

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[off-list ref] <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help