]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t6120-describe.sh
name-rev: avoid cutoff timestamp underflow
[thirdparty/git.git] / t / t6120-describe.sh
index 2b883d8174036b7d2246fcd89f239d7ecde049d4..45047d0a724e6bb7b59b4b3ae155ced530c660d1 100755 (executable)
@@ -424,4 +424,19 @@ test_expect_success 'describe complains about missing object' '
        test_must_fail git describe $ZERO_OID
 '
 
+test_expect_success 'name-rev a rev shortly after epoch' '
+       test_when_finished "git checkout master" &&
+
+       git checkout --orphan no-timestamp-underflow &&
+       # Any date closer to epoch than the CUTOFF_DATE_SLOP constant
+       # in builtin/name-rev.c.
+       GIT_COMMITTER_DATE="@1234 +0000" \
+       git commit -m "committer date shortly after epoch" &&
+       old_commit_oid=$(git rev-parse HEAD) &&
+
+       echo "$old_commit_oid no-timestamp-underflow" >expect &&
+       git name-rev $old_commit_oid >actual &&
+       test_cmp expect actual
+'
+
 test_done