Skip to content

Commit 1ec6482

Browse files
dotdashgitster
authored andcommitted
Add a test showing that 'git repack' throws away grafted-away parents
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 735c674 commit 1ec6482

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

t/t7700-repack.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,17 @@ test_expect_success 'local packed unreachable obs that exist in alternate ODB ar
149149
test_must_fail git show $csha1
150150
'
151151

152+
test_expect_failure 'objects made unreachable by grafts only are kept' '
153+
test_tick &&
154+
git commit --allow-empty -m "commit 4" &&
155+
H0=$(git rev-parse HEAD) &&
156+
H1=$(git rev-parse HEAD^) &&
157+
H2=$(git rev-parse HEAD^^) &&
158+
echo "$H0 $H2" > .git/info/grafts &&
159+
git reflog expire --expire=now --expire-unreachable=now --all &&
160+
git repack -a -d &&
161+
git cat-file -t $H1
162+
'
163+
152164
test_done
153165

0 commit comments

Comments
 (0)