git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] index-pack: Don't follow replace refs.
@ 2010-08-10  0:45 Nelson Elhage
  2010-08-12  3:17 ` Christian Couder
  0 siblings, 1 reply; 3+ messages in thread
From: Nelson Elhage @ 2010-08-10  0:45 UTC (permalink / raw)
  To: Christian Couder; +Cc: git, Nelson Elhage

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

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..b5635a7 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] index-pack: Don't follow replace refs.
  2010-08-10  0:45 [PATCH] index-pack: Don't follow replace refs Nelson Elhage
@ 2010-08-12  3:17 ` Christian Couder
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Couder @ 2010-08-12  3:17 UTC (permalink / raw)
  To: Nelson Elhage; +Cc: git

On Tuesday 10 August 2010 02:45:49 Nelson Elhage wrote:
> 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> !

I think it is a good patch except for a nit pick below.

> Signed-off-by: Nelson Elhage <nelhage@ksplice.com>
> ---
>  builtin/index-pack.c |    2 ++
>  t/t6050-replace.sh   |    6 ++++++
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> 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..b5635a7 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-

Maybe you could add "&&" at the end of the above line to make sure that an 
error in the commands is caught.

So, for what it's worth, if the above is fixed:

Acked-by: Christian Couder <chriscool@tuxfamily.org>

> +     git index-pack test-*.pack
> +'
> +
>  #
>  #
>  test_done

Thanks,
Christian.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] index-pack: Don't follow replace refs.
@ 2010-08-12 14:18 Nelson Elhage
  0 siblings, 0 replies; 3+ messages in thread
From: Nelson Elhage @ 2010-08-12 14:18 UTC (permalink / raw)
  To: gitster; +Cc: git, Christian Couder, Nelson Elhage

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(-)

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-12 14:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-10  0:45 [PATCH] index-pack: Don't follow replace refs Nelson Elhage
2010-08-12  3:17 ` Christian Couder
  -- strict thread matches above, loose matches on Subject: below --
2010-08-12 14:18 Nelson Elhage

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).