threads / patch / 24719

patchindex-pack: Don't follow replace refs.

Subject: [PATCH] index-pack: Don't follow replace refs.

## tl;dr

One message between Aug 12, 2010 and Aug 12, 2010. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Nelson Elhage· Aug 12, 2010, 14:18 UTC · lore

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>
---
 builtin/index-pack.c |    2 ++
 t/t6050-replace.sh   |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)
Show changes to 2 files +8 −0

builtin/index-pack.c, t/t6050-replace.sh

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index a89ae83..fad76bf 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -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().
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index 203ffdb..cf423b8 100755
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
@@ -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
-- 
1.7.1.29.g6093d

← back to recent threads