Commits

Junio C Hamano  committed 80ffb75 Merge

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

  • Participants
  • Parent commits e6dfbcf, 44b85e8

Comments (0)

Files changed (4)

 	unsigned long stamp;
 	int ofs;
 
-	if (*date < '0' || '9' <= *date)
+	if (*date < '0' || '9' < *date)
 		return -1;
 	stamp = strtoul(date, &end, 10);
 	if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-'))

File git-filter-branch.sh

 			s/.*/GIT_'$uid'_EMAIL='\''&'\''; export GIT_'$uid'_EMAIL/p
 
 			g
-			s/^'$lid' [^<]* <[^>]*> \(.*\)$/\1/
+			s/^'$lid' [^<]* <[^>]*> \(.*\)$/@\1/
 			s/'\''/'\''\'\'\''/g
 			s/.*/GIT_'$uid'_DATE='\''&'\''; export GIT_'$uid'_DATE/p
 

File t/t7003-filter-branch.sh

 
 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 &&

File t/test-lib-functions.sh

 # 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"
 }