git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
Nov 23, 2005, 14:37 UTC
Message-ID
<861x17pgzg.fsf@blue.stonehenge.com>
In-Reply-To
<20051123135150.GA16995@mythryan2.michonline.com>
>>>>> "Ryan" == Ryan Anderson <ryan@michonline.com> 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
<merlyn@stonehenge.com> <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!
Previous: Ryan AndersonNext: Johannes Schindelin
Message 5 of 7 in “Add git-graft-ripple, a tool for permanently grafting history into a tree.”
  1. Add git-graft-ripple, a tool for permanently grafting history into a tree.Ryan Anderson, Nov 22, 2005
  2. Linus TorvaldsNov 23, 2005
  3. Andreas EricssonNov 23, 2005
  4. Ryan AndersonNov 23, 2005
  5. Randal L. SchwartzNov 23, 2005
  6. Johannes SchindelinNov 23, 2005
  7. Linus TorvaldsNov 23, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.