@matheusbsbs / matheus-bagliano / commits / 7ff895c0d2
Fork 0

Test for recent rev-parse $abbrev_sha1 regression

My recent patch "Lazily open pack index files on demand" caused a regression in the case of parsing abbreviated SHA-1 object names. Git was unable to translate the abbreviated name into the full name if the object was packed, as the pack .idx files were not opened before being accessed. This is a simple test to repack a repository then test for an abbreviated SHA-1 within the packfile. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn O. Pearce committed May 30, 2007 at 00:50 UTC 7ff895c0d229c2c60b73e91b0c389a4e3ce69e46
1 file changed +10
t/t6101-rev-parse-parents.sh
+10
@@ -29,5 +29,15 @@ test_expect_success 'final^1^3 not valid' "if git-rev-parse --verify final^1^3;
29 test_expect_failure '--verify start2^1' 'git-rev-parse --verify start2^1'
30 test_expect_success '--verify start2^0' 'git-rev-parse --verify start2^0'
31
32 +test_expect_success 'repack for next test' 'git repack -a -d'
33 +test_expect_success 'short SHA-1 works' '
34 + start=`git rev-parse --verify start` &&
35 + echo $start &&
36 + abbrv=`echo $start | sed s/.\$//` &&
37 + echo $abbrv &&
38 + abbrv=`git rev-parse --verify $abbrv` &&
39 + echo $abbrv &&
40 + test $start = $abbrv'
41 +
42 test_done
43