Skip to content

Commit

Permalink
index-pack: Don't follow replace refs.
Browse files Browse the repository at this point in the history
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 <nelhage@ksplice.com>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nelson Elhage authored and Junio C Hamano committed Aug 12, 2010
1 parent b5e233e commit 6e2a09d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin/index-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(index_pack_usage);

read_replace_refs = 0;

/*
* We wish to read the repository's config file if any, and
* for that it is necessary to call setup_git_directory_gently().
Expand Down
6 changes: 6 additions & 0 deletions t/t6050-replace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ test_expect_success 'bisect and replacements' '
git bisect reset
'

test_expect_success 'index-pack and replacements' '
git --no-replace-objects rev-list --objects HEAD |
git --no-replace-objects pack-objects test- &&
git index-pack test-*.pack
'

#
#
test_done

0 comments on commit 6e2a09d

Please sign in to comment.