Skip to content

Commit 6e2a09d

Browse files
nelhagegitster
authored andcommitted
index-pack: Don't follow replace refs.
Without this, attempting to index a pack containing objects that have been replaced results in a fatal error that looks like: fatal: SHA1 COLLISION FOUND WITH <replaced-object> ! Signed-off-by: Nelson Elhage <[email protected]> Acked-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b5e233e commit 6e2a09d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

builtin/index-pack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
884884
if (argc == 2 && !strcmp(argv[1], "-h"))
885885
usage(index_pack_usage);
886886

887+
read_replace_refs = 0;
888+
887889
/*
888890
* We wish to read the repository's config file if any, and
889891
* for that it is necessary to call setup_git_directory_gently().

t/t6050-replace.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ test_expect_success 'bisect and replacements' '
219219
git bisect reset
220220
'
221221

222+
test_expect_success 'index-pack and replacements' '
223+
git --no-replace-objects rev-list --objects HEAD |
224+
git --no-replace-objects pack-objects test- &&
225+
git index-pack test-*.pack
226+
'
227+
222228
#
223229
#
224230
test_done

0 commit comments

Comments
 (0)