{"thread":{"id":"24686","subject":"[PATCH] index-pack: Don't follow replace refs.","startedAt":"2010-08-10T00:45:49Z","lastAt":"2010-08-12T03:17:53Z","messageCount":2,"participants":["Nelson Elhage","Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"147599","messageId":"1281401149-23141-1-git-send-email-nelhage@ksplice.com","threadId":"24686","inReplyTo":null,"subject":"[PATCH] index-pack: Don't follow replace refs.","fromName":"Nelson Elhage","fromEmail":"nelhage@ksplice.com","sentAt":"2010-08-10T00:45:49Z","receivedAt":"2010-08-10T00:45:49Z","isPatch":true,"sender":{"key":"nelhage@mit.edu","avatar":"https://avatars.githubusercontent.com/u/16725?v=4"},"body":"Without this, attempting to index a pack containing objects that have been\nreplaced results in a fatal error that looks like:\n\nfatal: SHA1 COLLISION FOUND WITH <replaced-object> !\nSigned-off-by: Nelson Elhage <nelhage@ksplice.com>\n---\n builtin/index-pack.c |    2 ++\n t/t6050-replace.sh   |    6 ++++++\n 2 files changed, 8 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex a89ae83..fad76bf 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -884,6 +884,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)\n \tif (argc == 2 && !strcmp(argv[1], \"-h\"))\n \t\tusage(index_pack_usage);\n \n+\tread_replace_refs = 0;\n+\n \t/*\n \t * We wish to read the repository's config file if any, and\n \t * for that it is necessary to call setup_git_directory_gently().\ndiff --git a/t/t6050-replace.sh b/t/t6050-replace.sh\nindex 203ffdb..b5635a7 100755\n--- a/t/t6050-replace.sh\n+++ b/t/t6050-replace.sh\n@@ -219,6 +219,12 @@ test_expect_success 'bisect and replacements' '\n      git bisect reset\n '\n \n+test_expect_success 'index-pack and replacements' '\n+     git --no-replace-objects rev-list --objects HEAD | \\\n+       git --no-replace-objects pack-objects test-\n+     git index-pack test-*.pack\n+'\n+\n #\n #\n test_done\n-- \n1.7.1.29.g6093d\n"},{"id":"147861","messageId":"201008120517.53874.chriscool@tuxfamily.org","threadId":"24686","inReplyTo":"1281401149-23141-1-git-send-email-nelhage@ksplice.com","subject":"Re: [PATCH] index-pack: Don't follow replace refs.","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2010-08-12T03:17:53Z","receivedAt":"2010-08-12T03:17:53Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Tuesday 10 August 2010 02:45:49 Nelson Elhage wrote:\n> Without this, attempting to index a pack containing objects that have been\n> replaced results in a fatal error that looks like:\n> \n> fatal: SHA1 COLLISION FOUND WITH <replaced-object> !\n\nI think it is a good patch except for a nit pick below.\n\n> Signed-off-by: Nelson Elhage <nelhage@ksplice.com>\n> ---\n>  builtin/index-pack.c |    2 ++\n>  t/t6050-replace.sh   |    6 ++++++\n>  2 files changed, 8 insertions(+), 0 deletions(-)\n> \n> diff --git a/builtin/index-pack.c b/builtin/index-pack.c\n> index a89ae83..fad76bf 100644\n> --- a/builtin/index-pack.c\n> +++ b/builtin/index-pack.c\n> @@ -884,6 +884,8 @@ int cmd_index_pack(int argc, const char **argv, const\n> char *prefix) if (argc == 2 && !strcmp(argv[1], \"-h\"))\n>  \t\tusage(index_pack_usage);\n> \n> +\tread_replace_refs = 0;\n> +\n>  \t/*\n>  \t * We wish to read the repository's config file if any, and\n>  \t * for that it is necessary to call setup_git_directory_gently().\n> diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh\n> index 203ffdb..b5635a7 100755\n> --- a/t/t6050-replace.sh\n> +++ b/t/t6050-replace.sh\n> @@ -219,6 +219,12 @@ test_expect_success 'bisect and replacements' '\n>       git bisect reset\n>  '\n> \n> +test_expect_success 'index-pack and replacements' '\n> +     git --no-replace-objects rev-list --objects HEAD | \\\n> +       git --no-replace-objects pack-objects test-\n\nMaybe you could add \"&&\" at the end of the above line to make sure that an \nerror in the commands is caught.\n\nSo, for what it's worth, if the above is fixed:\n\nAcked-by: Christian Couder <chriscool@tuxfamily.org>\n\n> +     git index-pack test-*.pack\n> +'\n> +\n>  #\n>  #\n>  test_done\n\nThanks,\nChristian.\n"}]}