Skip to content

Commit 80ffb75

Browse files
committed
Merge branch 'jc/maint-filter-branch-epoch-date' into maint
In 1.7.9 era, we taught "git rebase" about the raw timestamp format but we did not teach the same trick to "filter-branch", which rolled a similar logic on its own. * jc/maint-filter-branch-epoch-date: t7003: add test to filter a branch with a commit at epoch date.c: Fix off by one error in object-header date parsing filter-branch: do not forget the '@' prefix to force git-timestamp
2 parents e6dfbcf + 44b85e8 commit 80ffb75

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ static int match_object_header_date(const char *date, unsigned long *timestamp,
624624
unsigned long stamp;
625625
int ofs;
626626

627-
if (*date < '0' || '9' <= *date)
627+
if (*date < '0' || '9' < *date)
628628
return -1;
629629
stamp = strtoul(date, &end, 10);
630630
if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-'))

git-filter-branch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ set_ident () {
8484
s/.*/GIT_'$uid'_EMAIL='\''&'\''; export GIT_'$uid'_EMAIL/p
8585
8686
g
87-
s/^'$lid' [^<]* <[^>]*> \(.*\)$/\1/
87+
s/^'$lid' [^<]* <[^>]*> \(.*\)$/@\1/
8888
s/'\''/'\''\'\'\''/g
8989
s/.*/GIT_'$uid'_DATE='\''&'\''; export GIT_'$uid'_DATE/p
9090

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-functions.sh

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

145145
test_commit () {
146-
file=${2:-"$1.t"}
146+
notick= &&
147+
if test "z$1" = "z--notick"
148+
then
149+
notick=yes
150+
shift
151+
fi &&
152+
file=${2:-"$1.t"} &&
147153
echo "${3-$1}" > "$file" &&
148154
git add "$file" &&
149-
test_tick &&
155+
if test -z "$notick"
156+
then
157+
test_tick
158+
fi &&
150159
git commit -m "$1" &&
151160
git tag "$1"
152161
}

0 commit comments

Comments
 (0)