diff options
-rw-r--r-- | refs.c | 4 | ||||
-rwxr-xr-x | t/t1400-update-ref.sh | 9 |
2 files changed, 12 insertions, 1 deletions
@@ -1412,6 +1412,10 @@ int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char * tz = strtoul(tz_c, NULL, 10); if (get_sha1_hex(logdata, sha1)) die("Log %s is corrupt.", logfile); + if (is_null_sha1(sha1)) { + if (get_sha1_hex(logdata + 41, sha1)) + die("Log %s is corrupt.", logfile); + } if (msg) *msg = ref_msg(logdata, logend); munmap(log_mapped, mapsz); diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index f387d46f1..ca99d3761 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -155,7 +155,8 @@ rm -f .git/$m .git/logs/$m expect git update-ref $m $D cat >.git/logs/$m <<EOF -$C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500 +0000000000000000000000000000000000000000 $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500 +$C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500 $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500 $F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500 $Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500 @@ -186,6 +187,12 @@ test_expect_success \ 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \ 'rm -f o e git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e && + test '"$C"' = $(cat o) && + test "" = "$(cat e)"' +test_expect_success \ + 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' \ + 'rm -f o e + git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e && test '"$A"' = $(cat o) && test "" = "$(cat e)"' test_expect_success \ |