]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mda: set GIT_AUTHOR_DATE in commits as well
authorEric Wong <e@80x24.org>
Wed, 9 Apr 2014 22:42:38 +0000 (22:42 +0000)
committerEric Wong <e@80x24.org>
Wed, 9 Apr 2014 22:42:38 +0000 (22:42 +0000)
While we're at it, write some quick tests.

public-inbox-mda
t/mda.t

index 14017f68d265cf4fc4c9bde3864136f61dc18d49..411ac15f7f396a35b95b23387cd133f0f1e4deed 100755 (executable)
@@ -52,6 +52,7 @@ if (PublicInbox->precheck($filter, $recipient) &&
                        defined $email or $email = "";
                        local $ENV{GIT_AUTHOR_NAME} = $name;
                        local $ENV{GIT_AUTHOR_EMAIL} = $email;
+                       local $ENV{GIT_AUTHOR_DATE} = $simple->header("Date");
                        local $ENV{GIT_COMMITTER_EMAIL} = $recipient;
                        local $ENV{GIT_COMMITTER_NAME} = $dst->{listname};
 
diff --git a/t/mda.t b/t/mda.t
index 755864ca890a9f4540d947a5bca736c9abbe0492..de30b1251a1bb41fa495c53d6e281991a3d7f756 100644 (file)
--- a/t/mda.t
+++ b/t/mda.t
@@ -64,6 +64,12 @@ EOF
                local $ENV{GIT_DIR} = $maindir;
                my $rev = `git rev-list HEAD`;
                like($rev, qr/\A[a-f0-9]{40}/, "good revision committed");
+               chomp $rev;
+               my $cmt = `git cat-file commit $rev`;
+               like($cmt, qr/^author Me <me\@example\.com> 0 \+0000\n/m,
+                       "author info set correctly");
+               like($cmt, qr/^committer test <test-public\@example\.com>/m,
+                       "committer info set correctly");
        }
 
        # ensure failures work