Subject: Re: "fatal: index-pack failed" on git-clone

From: A Large Angry SCM <[email-masked]>
Date: Thu, 09 Jul 2009 19:29:27 -0400

Jeff King wrote:

 >
 > Signed-off-by: Jeff King <[email-masked]>
 > ---
 >  Makefile |   14 +++++++-------
 >  1 files changed, 7 insertions(+), 7 deletions(-)
 >
 > diff --git a/Makefile b/Makefile
 > index 78cc113..311ce7d 100644
 > --- a/Makefile
 > +++ b/Makefile
 > @@ -1641,15 +1641,15 @@ ifneq (,$X)
 >  endif
 >  	bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
 >  	execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
 > -	{ $(RM) "$$execdir/git-add$X" && \
 > +	{ $(RM) "$$execdir/git$X" && \
 >  		test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
 > -		ln "$$bindir/git$X" "$$execdir/git-add$X" 2>/dev/null || \
 > -		cp "$$bindir/git$X" "$$execdir/git-add$X"; } && \
 > -	{ for p in $(filter-out git-add$X,$(BUILT_INS)); do \
 > +		ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
 > +		cp "$$bindir/git$X" "$$execdir/git$X"; } && \
 > +	{ for p in $(BUILT_INS); do \
 >  		$(RM) "$$execdir/$$p" && \
 > -		ln "$$execdir/git-add$X" "$$execdir/$$p" 2>/dev/null || \
 > -		ln -s "git-add$X" "$$execdir/$$p" 2>/dev/null || \
 > -		cp "$$execdir/git-add$X" "$$execdir/$$p" || exit; \
 > +		ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
 > +		ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
 > +		cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
 >  	  done; } && \
 >  	./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
 >

This breaks the install if ${bindir} == ${execdir}. The following is 
needed on top Peff's patch.

diff --git a/Makefile b/Makefile
index 311ce7d..ec0fddf 100644
--- a/Makefile
+++ b/Makefile
@@ -1641,10 +1641,11 @@ ifneq (,$X)
  endif
  	bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
  	execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
-	{ $(RM) "$$execdir/git$X" && \
-		test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
-		ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
-		cp "$$bindir/git$X" "$$execdir/git$X"; } && \
+	{ test "$$bindir/git$X" = "$$execdir/git$X" || \
+		{ $(RM) "$$execdir/git$X" && \
+			test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
+			ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
+			cp "$$bindir/git$X" "$$execdir/git$X"; } } && \
  	{ for p in $(BUILT_INS); do \
  		$(RM) "$$execdir/$$p" && \
  		ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \