git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 11, 2009, 11:02 UTC
Message-ID
<alpine.DEB.1.00.0905111256580.4973@intel-tinevez-2-302>
In-Reply-To
<loom.20090511T101424-212@post.gmane.org>

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@gmx.de>
---
	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
Previous: Cedric StaniewskiNext: Cedric Staniewski
Message 2 of 6 in “Cross-directory hard links”
  1. Cedric StaniewskiMay 11, 2009
  2. Add NO_CROSS_DIRECTORY_HARDLINKS support to the MakefileJohannes Schindelin, May 11, 2009
  3. Cedric StaniewskiMay 11, 2009
  4. Johannes SchindelinMay 11, 2009
  5. Cedric StaniewskiMay 11, 2009
  6. Tony FinchMay 11, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.