Re: [PATCH 2/2] cvsimport: cleanup commit function
- From
Jeff King <peff@peff.net>
- Date
- May 23, 2006, 20:59 UTC
- Message-ID
- <20060523205944.GA16164@coredump.intra.peff.net>
- In-Reply-To
- <118833cc0605231047o2012deefh5e77b8496da1e673@mail.gmail.com>
On Tue, May 23, 2006 at 01:47:01PM -0400, Morten Welinder wrote:
Show 10 quoted lines
> Why run "env" and not just muck with %ENV? > >+ my $pid = open2(my $commit_read, my $commit_write, > >+ 'env', > >+ "GIT_AUTHOR_NAME=$author_name", > >+ "GIT_AUTHOR_EMAIL=$author_email", > >+ "GIT_AUTHOR_DATE=$commit_date", > >+ "GIT_COMMITTER_NAME=$author_name", > >+ "GIT_COMMITTER_EMAIL=$author_email", > >+ "GIT_COMMITTER_DATE=$commit_date", > >+ 'git-commit-tree', $tree, @commit_args);
Oops, that's an obvious fork optimization that I should have caught. Patch is below. Note that this will now affect the environment of all sub-processes, but it shouldn't matter since we reset it right before commit. However, if anyone is worried, we can stash the old %ENV in another hash temporarily.
-Peff
PS What is the preferred format for throwing patches into replies like this? Putting the patch at the end (as here) or throwing the reply comments in the ignored section near the diffstat?
--- cvsimport: set up commit environment in perl instead of using env
---
44c4a9f67322302ca49146a7c143c07ea67da366 git-cvsimport.perl | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-)
44c4a9f67322302ca49146a7c143c07ea67da366
diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 41ee9a6..83d7d3c 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -618,14 +618,13 @@ sub commit { } my $commit_date = strftime("+0000 %Y-%m-%d %H:%M:%S",gmtime($date)); + $ENV{GIT_AUTHOR_NAME} = $author_name; + $ENV{GIT_AUTHOR_EMAIL} = $author_email; + $ENV{GIT_AUTHOR_DATE} = $commit_date; + $ENV{GIT_COMMITTER_NAME} = $author_name; + $ENV{GIT_COMMITTER_EMAIL} = $author_email; + $ENV{GIT_COMMITTER_DATE} = $commit_date; my $pid = open2(my $commit_read, my $commit_write, - 'env', - "GIT_AUTHOR_NAME=$author_name", - "GIT_AUTHOR_EMAIL=$author_email", - "GIT_AUTHOR_DATE=$commit_date", - "GIT_COMMITTER_NAME=$author_name", - "GIT_COMMITTER_EMAIL=$author_email", - "GIT_COMMITTER_DATE=$commit_date", 'git-commit-tree', $tree, @commit_args); # compatibility with git2cvs
-- 1.3.3.g40505-dirty > - > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html