{"thread":{"id":"15052","subject":"[PATCH 6/6] Always provide a fallback when hardlinks fail","startedAt":"2008-08-17T09:00:51Z","lastAt":"2008-08-25T21:36:20Z","messageCount":6,"participants":["Andreas Färber","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"87421","messageId":"0EFF470D-341A-4619-910A-0F9C663D0B51@web.de","threadId":"15052","inReplyTo":null,"subject":"[PATCH 6/6] Always provide a fallback when hardlinks fail","fromName":"Andreas Färber","fromEmail":"andreas.faerber@web.de","sentAt":"2008-08-17T09:00:51Z","receivedAt":"2008-08-17T09:00:51Z","isPatch":true,"sender":{"key":"andreas.faerber@web.de","avatar":"https://gravatar.com/avatar/ac719235a76c4a5e248080fee1f7b6f507bdb1f3d71f7ae48457f3ead91ed1c0?d=mp&s=160"},"body":"BFS does not support hardlinks, so suppress the resulting error  \nmessages.\n\nSigned-off-by: Andreas Faerber <andreas.faerber@web.de>\nAcked-by: Ingo Weinhold <ingo_weinhold@gmx.de>\nAcked-by: Scott McCreary <scottmc2@gmail.com>\n---\nIn one place cp was already used as fallback, so I went that route.\nPersonally I would also be okay with symlinks as alternative.\n\n  Makefile |    6 +++---\n  1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 3daf9ac..7dc4bbd 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1106,7 +1106,7 @@ help.o: help.c common-cmds.h GIT-CFLAGS\n  \t\t'-DGIT_INFO_PATH=\"$(infodir_SQ)\"' $<\n\n  $(BUILT_INS): git$X\n-\t$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@\n+\t$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@ 2>/dev/null || cp git$X $@\n\n  common-cmds.h: ./generate-cmdlist.sh command-list.txt\n\n@@ -1373,10 +1373,10 @@ endif\n  \texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n  \tif test \"z$$bindir\" != \"z$$execdir\"; \\\n  \tthen \\\n-\t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" || \\\n+\t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" 2>/dev/null || \\\n  \t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n  \tfi && \\\n-\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git \n$X\" \"$$execdir/$p\" ;) } && \\\n+\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git \n$X\" \"$$execdir/$p\" 2>/dev/null || cp \"$$execdir/git$X\" \"$$execdir/ \n$p\" ;) } && \\\n  \tif test \"z$$bindir\" != \"z$$execdir\"; \\\n  \tthen \\\n  \t\t$(RM) \"$$execdir/git$X\"; \\\n-- \n1.6.0.rc3.32.g8aaa\n"},{"id":"87430","messageId":"7vljyv6gyo.fsf@gitster.siamese.dyndns.org","threadId":"15052","inReplyTo":"0EFF470D-341A-4619-910A-0F9C663D0B51@web.de","subject":"Re: [PATCH 6/6] Always provide a fallback when hardlinks fail","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-17T11:03:59Z","receivedAt":"2008-08-17T11:03:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Färber <andreas.faerber@web.de> writes:\n\n> BFS does not support hardlinks, so suppress the resulting error\n> messages.\n\nHmm, this is not specific to BFS.  I would have preferred if you brought\nup much earlier.\n\nYour patch seems to be whitespace damaged.  Here is an alternative.\n\nNote.\n\nWe currently install $(bindir)/git to $(gitexecdir)/git, make hardlinks to\n\"git-<cmd>\" from \"git\" inside $(gitexecdir), and then finally remove \"git\"\nin $(gitexecdir).\n\nWe could avoid this ugliness by:\n\n (1) install \"$(gitexecdir)/git-add\" (or any other single built-in) by\n     trying hardlink \"$(bindir)/git\", and if it fails by copying;\n\n (2) for the rest of built-ins, install \"$(gitexecdir)/git-<cmd>\" by trying\n     ln \"$(gitexecdir)/git-add\" \"$(gitexecdir)/git-<cmd>\", then\n     ln -s \"git-add\" \"$(gitexecdir)/git-<cmd>\", then finally\n     cp \"$(gitexecdir)/git-add\" \"$(gitexecdir)/git-<cmd>\".\n\nThat is not what I did, but it should be the right thing to do.  It is\nalready very late in the release cycle, and this whole thing can be done\nafter 1.6.0 final; we do not have to hurry.\n\n---\nFrom: Andreas Färber <andreas.faerber@web.de>\nDate: Sun, 17 Aug 2008 11:00:51 +0200\nSubject: [PATCH] Makefile: always provide a fallback when hardlinks fail\n\nWe make hardlinks from \"git\" to \"git-<cmd>\" built-ins and have been\ncareful to avoid cross-device links when linking \"git-<cmd>\" to gitexecdir.\n\nHowever, we were not prepared to deal with a build directory that is\nincapable of making hard links within itself.  This patch corrects it.\n\nWhile at it, avoid 100+ error messages from hardlink failures when we are\ngoing to fall back to \"cp\" by redirecting the standard error to /dev/null.\n\nSigned-off-by: Andreas Färber <andreas.faerber@web.de>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Makefile |   13 +++++++++----\n 1 files changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 53ab4b5..53112bb 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1098,7 +1098,10 @@ help.o: help.c common-cmds.h GIT-CFLAGS\n \t\t'-DGIT_INFO_PATH=\"$(infodir_SQ)\"' $<\n \n $(BUILT_INS): git$X\n-\t$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@\n+\t$(QUIET_BUILT_IN)$(RM) $@ && \\\n+\tln git$X $@ 2>/dev/null || \\\n+\tln -s git$X $@ 2>/dev/null || \\\n+\tcp git$X $@\n \n common-cmds.h: ./generate-cmdlist.sh command-list.txt\n \n@@ -1365,10 +1368,12 @@ endif\n \texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n \tif test \"z$$bindir\" != \"z$$execdir\"; \\\n \tthen \\\n-\t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" || \\\n-\t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n+\t\t$(RM) \"$$execdir/git$X\" && \\\n+\t\tln \"$$bindir/git$X\" \"$$execdir/git$X\" 2>/dev/null || \\\n+\t\tln -s \"$$bindir/git$X\" \"$$execdir/git$X\" 2>/dev/null || \\\n+\t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\" || exit; \\\n \tfi && \\\n-\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git$X\" \"$$execdir/$p\" ;) } && \\\n+\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git$X\" \"$$execdir/$p\" 2>/dev/null || cp \"$$execdir/git$X\" \"$$execdir/$p\" || exit;) } && \\\n \tif test \"z$$bindir\" != \"z$$execdir\"; \\\n \tthen \\\n \t\t$(RM) \"$$execdir/git$X\"; \\\n-- \n1.6.0.rc3.22.g053f\n"},{"id":"87433","messageId":"06F58415-2F22-44BE-8F19-70460DDF7F35@web.de","threadId":"15052","inReplyTo":"7vljyv6gyo.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 6/6] Always provide a fallback when hardlinks fail","fromName":"Andreas Färber","fromEmail":"andreas.faerber@web.de","sentAt":"2008-08-17T12:14:42Z","receivedAt":"2008-08-17T12:14:42Z","isPatch":true,"sender":{"key":"andreas.faerber@web.de","avatar":"https://gravatar.com/avatar/ac719235a76c4a5e248080fee1f7b6f507bdb1f3d71f7ae48457f3ead91ed1c0?d=mp&s=160"},"body":"\nAm 17.08.2008 um 13:03 schrieb Junio C Hamano:\n\n> Andreas Färber <andreas.faerber@web.de> writes:\n>\n>> BFS does not support hardlinks, so suppress the resulting error\n>> messages.\n>\n> Hmm, this is not specific to BFS.  I would have preferred if you  \n> brought\n> up much earlier.\n\nRight, it isn't. Do you mean earlier in time, or would you like me to  \nreorder it in my v2 series?\n\n> diff --git a/Makefile b/Makefile\n> index 53ab4b5..53112bb 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1098,7 +1098,10 @@ help.o: help.c common-cmds.h GIT-CFLAGS\n> \t\t'-DGIT_INFO_PATH=\"$(infodir_SQ)\"' $<\n>\n> $(BUILT_INS): git$X\n> -\t$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@\n> +\t$(QUIET_BUILT_IN)$(RM) $@ && \\\n> +\tln git$X $@ 2>/dev/null || \\\n> +\tln -s git$X $@ 2>/dev/null || \\\n> +\tcp git$X $@\n>\n> common-cmds.h: ./generate-cmdlist.sh command-list.txt\n>\n> @@ -1365,10 +1368,12 @@ endif\n> \texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n> \tif test \"z$$bindir\" != \"z$$execdir\"; \\\n> \tthen \\\n> -\t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" || \\\n> -\t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n> +\t\t$(RM) \"$$execdir/git$X\" && \\\n> +\t\tln \"$$bindir/git$X\" \"$$execdir/git$X\" 2>/dev/null || \\\n> +\t\tln -s \"$$bindir/git$X\" \"$$execdir/git$X\" 2>/dev/null || \\\n> +\t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\" || exit; \\\n> \tfi && \\\n> -\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/ \n> git$X\" \"$$execdir/$p\" ;) } && \\\n> +\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/ \n> git$X\" \"$$execdir/$p\" 2>/dev/null || cp \"$$execdir/git$X\" \"$$execdir/ \n> $p\" || exit;) } && \\\n> \tif test \"z$$bindir\" != \"z$$execdir\"; \\\n> \tthen \\\n> \t\t$(RM) \"$$execdir/git$X\"; \\\n\nLooks fine, I'll test it together with the other changes.\n\nAndreas\n"},{"id":"87448","messageId":"7vabfb5y33.fsf@gitster.siamese.dyndns.org","threadId":"15052","inReplyTo":"06F58415-2F22-44BE-8F19-70460DDF7F35@web.de","subject":"Re: [PATCH 6/6] Always provide a fallback when hardlinks fail","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-17T17:51:44Z","receivedAt":"2008-08-17T17:51:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Färber <andreas.faerber@web.de> writes:\n\n> Am 17.08.2008 um 13:03 schrieb Junio C Hamano:\n>\n>> Andreas Färber <andreas.faerber@web.de> writes:\n>>\n>>> BFS does not support hardlinks, so suppress the resulting error\n>>> messages.\n>>\n>> Hmm, this is not specific to BFS.  I would have preferred if you\n>> brought\n>> up much earlier.\n>\n> Right, it isn't. Do you mean earlier in time, or would you like me to\n> reorder it in my v2 series?\n\nSorry for being unclear.  I edited the message a few times and this part\ncame out quite differently as I intended.  It should have read this way:\n\n        Thanks for noticing (I would have preferred to hear about this a bit\n        earlier, not before the release day).\n\nAnyhow, thanks for the patch again.\n"},{"id":"88468","messageId":"D4374620-C6D8-4CB3-8A7D-C5449BB8E8D1@web.de","threadId":"15052","inReplyTo":"7vljyv6gyo.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] Makefile: always provide a fallback when hardlinks fail","fromName":"Andreas Färber","fromEmail":"andreas.faerber@web.de","sentAt":"2008-08-25T15:42:21Z","receivedAt":"2008-08-25T15:42:21Z","isPatch":true,"sender":{"key":"andreas.faerber@web.de","avatar":"https://gravatar.com/avatar/ac719235a76c4a5e248080fee1f7b6f507bdb1f3d71f7ae48457f3ead91ed1c0?d=mp&s=160"},"body":"\nAm 17.08.2008 um 13:03 schrieb Junio C Hamano:\n\n> Andreas Färber <andreas.faerber@web.de> writes:\n>\n>> BFS does not support hardlinks, so suppress the resulting error\n>> messages.\n>\n> Hmm, this is not specific to BFS.  [...]\n>\n> Your patch seems to be whitespace damaged.  Here is an alternative.\n>\n> Note.\n>\n> We currently install $(bindir)/git to $(gitexecdir)/git, make  \n> hardlinks to\n> \"git-<cmd>\" from \"git\" inside $(gitexecdir), and then finally remove  \n> \"git\"\n> in $(gitexecdir).\n>\n> We could avoid this ugliness by:\n>\n> (1) install \"$(gitexecdir)/git-add\" (or any other single built-in) by\n>     trying hardlink \"$(bindir)/git\", and if it fails by copying;\n>\n> (2) for the rest of built-ins, install \"$(gitexecdir)/git-<cmd>\" by  \n> trying\n>     ln \"$(gitexecdir)/git-add\" \"$(gitexecdir)/git-<cmd>\", then\n>     ln -s \"git-add\" \"$(gitexecdir)/git-<cmd>\", then finally\n>     cp \"$(gitexecdir)/git-add\" \"$(gitexecdir)/git-<cmd>\".\n>\n> That is not what I did, but it should be the right thing to do.  It is\n> already very late in the release cycle, and this whole thing can be  \n> done\n> after 1.6.0 final; we do not have to hurry.\n\nI've tried to implement what you've outlined above.\n\nOn Haiku this now results in symlinks within the build dir for the  \nbuiltins including git-add, and in symlinks for all builtins but git- \nadd in $prefix/libexec/git-core.\n\n---\nFrom: Andreas Faerber <andreas.faerber@web.de>\nDate: Mon, 25 Aug 2008 17:33:03 +0200\nSubject: [PATCH] Makefile: always provide a fallback when hardlinks fail\n\nWe make hardlinks from \"git\" to \"git-<cmd>\" built-ins and have been\ncareful to avoid cross-device links when linking \"git-<cmd>\" to  \ngitexecdir.\n\nHowever, we were not prepared to deal with a build directory that is\nincapable of making hard links within itself. This patch corrects it.\n\nInstead of temporarily linking \"git\" to gitexecdir, directly link \"git- \nadd\",\nfalling back to \"cp\". Try hardlinking that as \"git-<cmd>\", falling back\nto symlinks or \"cp\" on error.\n\nWhile at it, avoid 100+ error messages from hardlink failures when we  \nare\ngoing to fall back to symlinks or \"cp\" by redirecting the standard error\nto /dev/null.\n\nSigned-off-by: Andreas Färber <andreas.faerber@web.de>\n---\n  Makefile |   22 +++++++++++-----------\n  1 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 7a6cbb6..fb4863c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1110,7 +1110,10 @@ help.o: help.c common-cmds.h GIT-CFLAGS\n  \t\t'-DGIT_INFO_PATH=\"$(infodir_SQ)\"' $<\n\n  $(BUILT_INS): git$X\n-\t$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@\n+\t$(QUIET_BUILT_IN)$(RM) $@ && \\\n+\tln git$X $@ 2>/dev/null || \\\n+\tln -s git$X $@ 2>/dev/null || \\\n+\tcp git$X $@\n\n  common-cmds.h: ./generate-cmdlist.sh command-list.txt\n\n@@ -1371,16 +1374,13 @@ ifneq (,$X)\n  endif\n  \tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n  \texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n-\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n-\tthen \\\n-\t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" || \\\n-\t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n-\tfi && \\\n-\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git \n$X\" \"$$execdir/$p\" ;) } && \\\n-\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n-\tthen \\\n-\t\t$(RM) \"$$execdir/git$X\"; \\\n-\tfi && \\\n+\t{ $(RM) \"$$execdir/git-add$X\" && \\\n+\t\tln git-add$X \"$$execdir/git-add$X\" 2>/dev/null || \\\n+\t\tcp git-add$X \"$$execdir/git-add$X\"; } && \\\n+\t{ $(foreach p,$(patsubst git-add,,$(BUILT_INS)), $(RM) \"$$execdir/ \n$p\" && \\\n+\t\tln \"$$execdir/git-add$X\" \"$$execdir/$p\" 2>/dev/null || \\\n+\t\tln -s \"$$execdir/git-add$X\" \"$$execdir/$p\" 2>/dev/null || \\\n+\t\tcp \"$$execdir/git-add$X\" \"$$execdir/$p\" || exit;) } && \\\n  \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n\n  install-doc:\n-- \n1.6.0.1.91.gaea6\n\n\n\nFrom aea60501ba1651f7ba51de8381db5355d6df472b Mon Sep 17 00:00:00 2001\nFrom: Andreas Faerber <andreas.faerber@web.de>\nDate: Mon, 25 Aug 2008 17:33:03 +0200\nSubject: [PATCH] Makefile: always provide a fallback when hardlinks fail\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\nWe make hardlinks from \"git\" to \"git-<cmd>\" built-ins and have been\ncareful to avoid cross-device links when linking \"git-<cmd>\" to gitexecdir.\n\nHowever, we were not prepared to deal with a build directory that is\nincapable of making hard links within itself. This patch corrects it.\n\nInstead of temporarily linking \"git\" to gitexecdir, directly link \"git-add\",\nfalling back to \"cp\". Try hardlinking that as \"git-<cmd>\", falling back\nto symlinks or \"cp\" on error.\n\nWhile at it, avoid 100+ error messages from hardlink failures when we are\ngoing to fall back to symlinks or \"cp\" by redirecting the standard error\nto /dev/null.\n\nSigned-off-by: Andreas Färber <andreas.faerber@web.de>\n---\n Makefile |   22 +++++++++++-----------\n 1 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 7a6cbb6..fb4863c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1110,7 +1110,10 @@ help.o: help.c common-cmds.h GIT-CFLAGS\n \t\t'-DGIT_INFO_PATH=\"$(infodir_SQ)\"' $<\n \n $(BUILT_INS): git$X\n-\t$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@\n+\t$(QUIET_BUILT_IN)$(RM) $@ && \\\n+\tln git$X $@ 2>/dev/null || \\\n+\tln -s git$X $@ 2>/dev/null || \\\n+\tcp git$X $@\n \n common-cmds.h: ./generate-cmdlist.sh command-list.txt\n \n@@ -1371,16 +1374,13 @@ ifneq (,$X)\n endif\n \tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n \texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n-\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n-\tthen \\\n-\t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" || \\\n-\t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n-\tfi && \\\n-\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln \"$$execdir/git$X\" \"$$execdir/$p\" ;) } && \\\n-\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n-\tthen \\\n-\t\t$(RM) \"$$execdir/git$X\"; \\\n-\tfi && \\\n+\t{ $(RM) \"$$execdir/git-add$X\" && \\\n+\t\tln git-add$X \"$$execdir/git-add$X\" 2>/dev/null || \\\n+\t\tcp git-add$X \"$$execdir/git-add$X\"; } && \\\n+\t{ $(foreach p,$(patsubst git-add,,$(BUILT_INS)), $(RM) \"$$execdir/$p\" && \\\n+\t\tln \"$$execdir/git-add$X\" \"$$execdir/$p\" 2>/dev/null || \\\n+\t\tln -s \"$$execdir/git-add$X\" \"$$execdir/$p\" 2>/dev/null || \\\n+\t\tcp \"$$execdir/git-add$X\" \"$$execdir/$p\" || exit;) } && \\\n \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n \n install-doc:\n-- \n1.6.0.1.91.gaea6\n\n\n\n\n\n"},{"id":"88516","messageId":"7vej4cg4kr.fsf@gitster.siamese.dyndns.org","threadId":"15052","inReplyTo":"D4374620-C6D8-4CB3-8A7D-C5449BB8E8D1@web.de","subject":"Re: [PATCH] Makefile: always provide a fallback when hardlinks fail","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-25T21:36:20Z","receivedAt":"2008-08-25T21:36:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Färber <andreas.faerber@web.de> writes:\n\n> From: Andreas Faerber <andreas.faerber@web.de>\n> Date: Mon, 25 Aug 2008 17:33:03 +0200\n> Subject: [PATCH] Makefile: always provide a fallback when hardlinks fail\n>\n> We make hardlinks from \"git\" to \"git-<cmd>\" built-ins and have been\n> careful to avoid cross-device links when linking \"git-<cmd>\" to\n> gitexecdir.\n>\n> However, we were not prepared to deal with a build directory that is\n> incapable of making hard links within itself. This patch corrects it.\n>\n> Instead of temporarily linking \"git\" to gitexecdir, directly link \"git-\n> add\", falling back to \"cp\". Try hardlinking that as \"git-<cmd>\", falling\n> back to symlinks or \"cp\" on error.\n>\n> While at it, avoid 100+ error messages from hardlink failures when we\n> are going to fall back to symlinks or \"cp\" by redirecting the standard\n> error to /dev/null.\n>\n> Signed-off-by: Andreas Färber <andreas.faerber@web.de>\n> ---\n>  Makefile |   22 +++++++++++-----------\n>  1 files changed, 11 insertions(+), 11 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 7a6cbb6..fb4863c 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1110,7 +1110,10 @@ help.o: help.c common-cmds.h GIT-CFLAGS\n>  \t\t'-DGIT_INFO_PATH=\"$(infodir_SQ)\"' $<\n>\n>  $(BUILT_INS): git$X\n> -\t$(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@\n> +\t$(QUIET_BUILT_IN)$(RM) $@ && \\\n> +\tln git$X $@ 2>/dev/null || \\\n> +\tln -s git$X $@ 2>/dev/null || \\\n> +\tcp git$X $@\n\nOk.\n\n>\n>  common-cmds.h: ./generate-cmdlist.sh command-list.txt\n>\n> @@ -1371,16 +1374,13 @@ ifneq (,$X)\n>  endif\n>  \tbindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \\\n>  \texecdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \\\n> -\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n> -\tthen \\\n> -\t\tln -f \"$$bindir/git$X\" \"$$execdir/git$X\" || \\\n> -\t\tcp \"$$bindir/git$X\" \"$$execdir/git$X\"; \\\n> -\tfi && \\\n> -\t{ $(foreach p,$(BUILT_INS), $(RM) \"$$execdir/$p\" && ln\n> \"$$execdir/git\n> $X\" \"$$execdir/$p\" ;) } && \\\n> -\tif test \"z$$bindir\" != \"z$$execdir\"; \\\n> -\tthen \\\n> -\t\t$(RM) \"$$execdir/git$X\"; \\\n> -\tfi && \\\n\n(mental note while reviewing the change) Outside context before this part\nwe have installed \"git$X\" to $$bindir, and removed leftover \"git-foo\"\nwithout .exe on the platform where X=.exe.\n\n> +\t{ $(RM) \"$$execdir/git-add$X\" && \\\n> +\t\tln git-add$X \"$$execdir/git-add$X\" 2>/dev/null || \\\n> +\t\tcp git-add$X \"$$execdir/git-add$X\"; } && \\\n\n(mental note while reviewing the change) First, we install git-add$X to\n$$execdir, either hardlink or copy.\n\n> +\t{ $(foreach p,$(patsubst git-add,,$(BUILT_INS)), $(RM)\n> \"$$execdir/\n> $p\" && \\\n> +\t\tln \"$$execdir/git-add$X\" \"$$execdir/$p\" 2>/dev/null || \\\n> +\t\tln -s \"$$execdir/git-add$X\" \"$$execdir/$p\" 2>/dev/null || \\\n> +\t\tcp \"$$execdir/git-add$X\" \"$$execdir/$p\" || exit;) } && \\\n\n    Nits.\n\n    * Line-wrapped;\n    * $(patsubst) is probably $(filter-out);\n\n(mental note while reviewing the change) Then we install the rest by\nlinking, symlinking or copying git-add$X.\n\nWe might want to do the \"symlinking\" to $$bindir/git$X instead, but other\nthan that (and above two minor nits), this looks pretty good.\n\nThanks, will try and apply.\n"}]}