t7003: add test to filter a branch with a commit at epoch
authorJunio C Hamano <gitster@pobox.com>
Thu, 12 Jul 2012 20:51:37 +0000 (13:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Jul 2012 21:23:42 +0000 (14:23 -0700)
Running filter-branch on a history that has a commit with timestamp
at epoch used to fail, but it should have been fixed.  Add test to
make sure it won't break again.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7003-filter-branch.sh
t/test-lib.sh

index e0227730deb88413301b37501fdb165a2c90460e..4d13e10de1f2594ab304b3a2b7b5905d75d6ff84 100755 (executable)
@@ -5,7 +5,8 @@ test_description='git filter-branch'
 
 test_expect_success 'setup' '
        test_commit A &&
-       test_commit B &&
+       GIT_COMMITTER_DATE="@0 +0000" GIT_AUTHOR_DATE="@0 +0000" &&
+       test_commit --notick B &&
        git checkout -b branch B &&
        test_commit D &&
        mkdir dir &&
index d7dfc8b0b1939180f16b8245e58465f883e85cbc..f3a50d4cb34844812cdfea2a0f24bfe732710ffd 100644 (file)
@@ -335,10 +335,19 @@ test_tick () {
 # Both <file> and <contents> default to <message>.
 
 test_commit () {
-       file=${2:-"$1.t"}
+       notick= &&
+       if test "z$1" = "z--notick"
+       then
+               notick=yes
+               shift
+       fi &&
+       file=${2:-"$1.t"} &&
        echo "${3-$1}" > "$file" &&
        git add "$file" &&
-       test_tick &&
+       if test -z "$notick"
+       then
+               test_tick
+       fi &&
        git commit -m "$1" &&
        git tag "$1"
 }