All of lore.kernel.org
 help / color / mirror / Atom feed
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: Ryan Anderson <ryan@michonline.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Junio C Hamano <junkio@cox.net>,
	git@vger.kernel.org
Subject: Re: [PATCH] Add git-graft-ripple, a tool for permanently grafting history into a tree.
Date: 23 Nov 2005 06:37:55 -0800	[thread overview]
Message-ID: <861x17pgzg.fsf@blue.stonehenge.com> (raw)
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!

  reply	other threads:[~2005-11-23 14:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-22 20:50 [PATCH] Add git-graft-ripple, a tool for permanently grafting history into a tree Ryan Anderson
2005-11-23  0:55 ` Linus Torvalds
2005-11-23  7:22   ` Andreas Ericsson
2005-11-23 13:51   ` Ryan Anderson
2005-11-23 14:37     ` Randal L. Schwartz [this message]
2005-11-23 15:40     ` Johannes Schindelin
2005-11-23 17:07     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=861x17pgzg.fsf@blue.stonehenge.com \
    --to=merlyn@stonehenge.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=ryan@michonline.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.