From 40919c483a28f34d43fbef2a84a294b3554caffd Mon Sep 17 00:00:00 2001
From: Brandon Casey <drafnel@gmail.com>
Date: Fri, 23 Jul 2010 12:50:44 -0500
Subject: [PATCH 1/2] Makefile: link builtins residing in bin directory to main
 git binary too

To conserve space/improve file caching we try to make hard or symbolic links
from each builtin program to the main git executable rather than having
each be a complete duplicate copy of it.  We weren't doing this for the
builtin programs residing in the bin directory though.  So, let's do so.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Makefile b/Makefile
index bc3c57058fa..d725c1532f2 100644
--- a/Makefile
+++ b/Makefile
@@ -2079,6 +2079,12 @@ endif
 		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 $(filter $(install_bindir_programs),$(BUILT_INS)); do \
+		$(RM) "$$bindir/$$p" && \
+		ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
+		ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
+		cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
+	done && \
 	for p in $(BUILT_INS); do \
 		$(RM) "$$execdir/$$p" && \
 		ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \

From 76d079aa561a74d2c290d5ab7e3b69549ff325cb Mon Sep 17 00:00:00 2001
From: Brandon Casey <drafnel@gmail.com>
Date: Fri, 23 Jul 2010 12:50:45 -0500
Subject: [PATCH 2/2] Makefile: make hard/symbolic links for non-builtins too

To conserve space/improve file caching we try to make hard or symbolic links
from each builtin program to the main git executable rather than having
each be a complete duplicate copy of it.  We weren't doing this for the
non-builtin programs though.  So, just because we can, and because it's
easy, and for completeness sake, let's do it.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Makefile | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index d725c1532f2..17c91301b54 100644
--- a/Makefile
+++ b/Makefile
@@ -2075,10 +2075,13 @@ endif
 	bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
 	execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
 	{ test "$$bindir/" = "$$execdir/" || \
-		{ $(RM) "$$execdir/git$X" && \
+	  for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
+		$(RM) "$$execdir/$$p" && \
 		test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
-		ln "$$bindir/git$X" "$$execdir/git$X" 2>/dev/null || \
-		cp "$$bindir/git$X" "$$execdir/git$X"; } ; } && \
+		ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
+		cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
+	  done; \
+	} && \
 	for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
 		$(RM) "$$bindir/$$p" && \
 		ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \