The authorship info in commits created by git-cvsimport-script
only contains the username of the CVS committer.  This patch
adds a flag -e <domain> to git-cvsimport-script that makes it
possible to specify an email domain that is added to all email
addresses in the commit "author" and "committer" fields.

---
I have stopped using cvsimport, because cvsps seems to produce bad
output on the repository I'm using it with, but I had already prepared
this patch.

 Documentation/git-cvsimport-script.txt |    8 +++++++-
 git-cvsimport-script                   |   18 +++++++++++++-----
 2 files changed, 20 insertions(+), 6 deletions(-)

cabbc2b5cae2dcd892d02a3c679698cdfb3b9de5
diff --git a/Documentation/git-cvsimport-script.txt 
b/Documentation/git-cvsimport-script.txt
--- a/Documentation/git-cvsimport-script.txt
+++ b/Documentation/git-cvsimport-script.txt
@@ -12,7 +12,9 @@ SYNOPSIS
 'git-cvsimport-script' [ -o <branch-for-HEAD> ] [ -h ] [ -v ]
                        [ -d <CVSROOT> ] [ -p <options-for-cvsps> ]
                        [ -C <GIT_repository> ] [ -i ] [ -k ]
-                       [ -s <subst> ] [ -m ] [ -M regex ] [ <CVS_module> ]
+                       [ -s <subst> ] [ -m ] [ -M regex ]
+                       [ -e <domain> ]
+                       [ <CVS_module> ]
 
 
 DESCRIPTION
@@ -86,6 +88,10 @@ OPTIONS
 -s <subst>::
        Substitute the character "/" in branch names with <subst>
 
+-e <domain>::
+        Append '@<domain>' to the author name to use as the email
+        address in commit objects.
+
 OUTPUT
 ------
 If '-v' is specified, the script reports what it is doing.
diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -29,19 +29,20 @@ use IPC::Open2;
 $SIG{'PIPE'}="IGNORE";
 $ENV{'TZ'}="UTC";
 
-our($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_s,$opt_m,$opt_M);
+our($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_s,$opt_m,$opt_M,$opt_e);
 
 sub usage() {
        print STDERR <<END;
 Usage: ${\basename $0}     # fetch/update GIT from CVS
        [-o branch-for-HEAD] [-h] [-v] [-d CVSROOT]
        [-p opts-for-cvsps] [-C GIT_repository] [-z fuzz]
-       [-i] [-k] [-u] [-s subst] [-m] [-M regex] [CVS_module]
+       [-i] [-k] [-u] [-s subst] [-m] [-M regex] [ -e email-domain ]
+       [CVS_module]
 END
        exit(1);
 }
 
-getopts("hivmkuo:d:p:C:z:s:M:") or usage();
+getopts("hivmkuo:d:p:C:z:s:M:e:") or usage();
 usage if $opt_h;
 
 @ARGV <= 1 or usage();
@@ -85,6 +86,13 @@ if ($opt_M) {
        push (@mergerx, qr/$opt_M/);
 }
 
+our $email_suffix;
+if ($opt_e) {
+    $email_suffix = "@"."$opt_e";
+} else {
+    $email_suffix = "";
+}
+
 select(STDERR); $|=1; select(STDOUT);
 
 
@@ -592,10 +600,10 @@ my $commit = sub {
 
                exec("env",
                        "GIT_AUTHOR_NAME=$author",
-                       "GIT_AUTHOR_EMAIL=$author",
+                       "GIT_AUTHOR_EMAIL=$author$email_suffix",
                        "GIT_AUTHOR_DATE=".strftime("+0000 %Y-%m-%d 
%H:%M:%S",gmtime($date)),
                        "GIT_COMMITTER_NAME=$author",
-                       "GIT_COMMITTER_EMAIL=$author",
+                       "GIT_COMMITTER_EMAIL=$author$email_suffix",
                        "GIT_COMMITTER_DATE=".strftime("+0000 %Y-%m-%d 
%H:%M:%S",gmtime($date)),
                        "git-commit-tree", $tree,@par);
                die "Cannot exec git-commit-tree: $!\n";

-- 
David Kågedal

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to