Skip to content

Commit 44b85e8

Browse files
committed
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 <[email protected]>
1 parent be21d16 commit 44b85e8

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

t/t7003-filter-branch.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ test_description='git filter-branch'
55

66
test_expect_success 'setup' '
77
test_commit A &&
8-
test_commit B &&
8+
GIT_COMMITTER_DATE="@0 +0000" GIT_AUTHOR_DATE="@0 +0000" &&
9+
test_commit --notick B &&
910
git checkout -b branch B &&
1011
test_commit D &&
1112
mkdir dir &&

t/test-lib.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,19 @@ test_tick () {
335335
# Both <file> and <contents> default to <message>.
336336

337337
test_commit () {
338-
file=${2:-"$1.t"}
338+
notick= &&
339+
if test "z$1" = "z--notick"
340+
then
341+
notick=yes
342+
shift
343+
fi &&
344+
file=${2:-"$1.t"} &&
339345
echo "${3-$1}" > "$file" &&
340346
git add "$file" &&
341-
test_tick &&
347+
if test -z "$notick"
348+
then
349+
test_tick
350+
fi &&
342351
git commit -m "$1" &&
343352
git tag "$1"
344353
}

0 commit comments

Comments
 (0)