[PATCH] Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the installed programs are tar'ed up and installed on a system where
bin/ and libexec/git-core/ live on different file systems, we do not want
libexec/git-core/git-* to be hardlinks to bin/git.

Noticed by Cedric Staniewski.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---

	On Mon, 11 May 2009, Cedric Staniewski wrote:

	> git commit 6a0861 [1] made bin/git the target of the builtins 
	> hard links which results in 'cross-directory' hard links. While the 
	> Makefile always works fine for the local installation via 'make 
	> install', these links can raise trouble when installing git via
	> package manager.

	I do not understand how this commit could be responsible, but here 
	is an attempt to fix things.

 Makefile |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 6e21643..b00e22d 100644
--- a/Makefile
+++ b/Makefile
@@ -175,6 +175,9 @@ all::
 # Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
 # when hardlinking a file to another name and unlinking the original file right
 # away (some NTFS drivers seem to zero the contents in that scenario).
+#
+# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
+# programs as a tar, where bin/ and libexec/ might be on different file systems.
 
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1549,6 +1552,7 @@ endif
 	bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
 	execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
 	{ $(RM) "$$execdir/git-add$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 \
-- 
1.6.3.49.g4d15.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]