Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Use GIT_COMMITTER_IDENT instead of hardcoded values in import-tars.perl

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:19
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Mike Hommey [off-list ref] writes:
Signed-off-by: Mike Hommey <redacted>
---

http://marc.info/?l=git&m=120385776127178&w=2:
quoted
quoted
 And that made me wonder if it wouldn't be worth, actually, to have
git config user.name and git config user.email return the "magic" values
gotten from guessing in ident.c when no value is in the config. That would
allow scripts, which have no other simple means to get the user name and
email, to have the same feature as builtins.
Or perhaps use "git var GIT_COMMITTER_IDENT"?
The only problem I see with this approach is that lots of uses of
GIT_COMMITTER_IDENT require regex'ing the output to remove the date
(see git-am, old git-commit and git-tag...)

Maybe adding another variable not containing the date would be a
good idea?
Looking at the two patches side-by-side makes me think your original from
from February actually is much better.

Why don't we apply your original, reproduced here for a quick round of
comment?

-- >8 --
From: Mike Hommey <redacted>
Subject: [PATCH] Use user.name and user.email in import-tars.perl
Date: Sun, 24 Feb 2008 13:57:18 +0100

Mimic what is done in git-import.sh and git-import.perl

Signed-off-by: Mike Hommey <redacted>
---
 contrib/fast-import/import-tars.perl |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl
index 23aeb25..39c091c 100755
--- a/contrib/fast-import/import-tars.perl
+++ b/contrib/fast-import/import-tars.perl
@@ -14,8 +14,10 @@ die "usage: import-tars *.tar.{gz,bz2,Z}\n" unless @ARGV;
 
 my $branch_name = 'import-tars';
 my $branch_ref = "refs/heads/$branch_name";
-my $committer_name = 'T Ar Creator';
-my $committer_email = 'tar@example.com';
+chomp(my $committer_name = `git config user.name`);
+chomp(my $committer_email = `git config user.email`);
+die 'You need to set user name and email'
+  unless $committer_name && $committer_email;
 
 open(FI, '|-', 'git', 'fast-import', '--quiet')
 	or die "Unable to start git fast-import: $!\n";
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help