summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-12 20:51:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-07-12 21:23:42 (GMT)
commit44b85e89d70da5ee7fc688d4a9c021f6a419b363 (patch)
tree06d22efd420072ec0657f85ac973e543039238a2
parentbe21d167b2a819fd2b4991a395e95906b3cb176a (diff)
downloadgit-44b85e89d70da5ee7fc688d4a9c021f6a419b363.zip
git-44b85e89d70da5ee7fc688d4a9c021f6a419b363.tar.gz
git-44b85e89d70da5ee7fc688d4a9c021f6a419b363.tar.bz2
t7003: add test to filter a branch with a commit at epoch
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>
-rwxr-xr-xt/t7003-filter-branch.sh3
-rw-r--r--t/test-lib.sh13
2 files changed, 13 insertions, 3 deletions
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index e022773..4d13e10 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -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 &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index d7dfc8b..f3a50d4 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -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"
}