Merge branch 'jc/maint-filter-branch-epoch-date' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 30 Jul 2012 20:03:40 +0000 (13:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Jul 2012 20:04:18 +0000 (13:04 -0700)
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

date.c
git-filter-branch.sh
t/t7003-filter-branch.sh
t/test-lib-functions.sh
diff --git a/date.c b/date.c
index 1fdcf7c6eae0386552c5d7e069f5242fca3c2e0e..57331ed406e2391e0a2bf327fbb86d3b62012324 100644 (file)
--- a/date.c
+++ b/date.c
@@ -624,7 +624,7 @@ static int match_object_header_date(const char *date, unsigned long *timestamp,
        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] != '-'))
index add2c0247fa91e0f629428c295fc581f19cf85e1..178e45305d2b66bbe5a0c0902d989ea66888869b 100755 (executable)
@@ -84,7 +84,7 @@ set_ident () {
                        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
 
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 16397691d951864f760b832ee066a63cd83f64fc..80daaca7806cbe1a6de0ddeba40400c8a811328e 100644 (file)
@@ -143,10 +143,19 @@ test_pause () {
 # 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"
 }