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

[RFC/PATCH 5/5] Makefile: Add a NO_INSTALL_BUILTIN_EXECDIR_ALIASES flag

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 2, 2018, 22:37 UTC
Message-ID
<20181102223743.4331-6-avarab@gmail.com>
In-Reply-To
<87efkkdwcv.fsf@evledraar.gmail.com>

Back when git was initially written the likes of "git-add", "git-init" etc. were installed in the user's $PATH. A few years later everything, with a few exceptions like git-upload-pack and git-receive-pack, was expected to be invoked as "git $cmd".

Now something like a decade later we're still installing these old commands in gitexecdir. This is so someone with a shellscript that still targets e.g. "git-init" can add $(git --exec-path) to their $PATH and not have to change their script.

Let's add an option to break this backwards compatibility. Now with NO_INSTALL_BUILTIN_EXECDIR_ALIASES=YesPlease there's only 3 programs in the bindir that are hardlinked to "git" (receive-pack, upload-archive & upload-pack), and 3 in the gitexecdir (git-remote-{ftp,ftps,https} linked to git-remote-http).

There's no cross-directory links anymore, so the "NO_CROSS_DIRECTORY_HARDLINKS" flag becomes redundant under this new option.

1. https://public-inbox.org/git/87woyfdkoi.fsf@evledraar.gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile         |  8 ++++++++
 install_programs | 36 +++++++++++++++++++++---------------
 2 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index 07c8b74353..a849a7b6d1 100644
--- a/Makefile
+++ b/Makefile
@@ -346,6 +346,13 @@ all::
 # INSTALL_SYMLINKS if you'd prefer not to have the install procedure
 # fallack on hardlinking or copying if "ln -s" fails.
 #
+# Define NO_INSTALL_BUILTIN_EXECDIR_ALIASES if you'd like to skip
+# installing legacy such as "git-init" and "git-add" in the
+# gitexecdir. Unless you're on a system where "which git-init" is
+# expected to returns something set this. Users have been expected to
+# use the likes of "git init" for ages now, these programs were only
+# provided for legacy compatibility.
+#
 # 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.
 #
@@ -2823,6 +2830,7 @@ endif
 		--flag-no-install-hardlinks="$(NO_INSTALL_HARDLINKS)" \
 		--flag-no-cross-directory-hardlinks="$(NO_CROSS_DIRECTORY_HARDLINKS)" \
 		--flag-no-install-symlinks-fallback="$(NO_INSTALL_SYMLINKS_FALLBACK)" \
+		--flag-no-install-builtin-execdir-aliases="$(NO_INSTALL_BUILTIN_EXECDIR_ALIASES)" \
 		--list-bindir-standalone="git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS))" \
 		--list-bindir-git-dashed="$(filter $(install_bindir_programs),$(BUILT_INS))" \
 		--list-execdir-git-dashed="$(BUILT_INS)" \
diff --git a/install_programs b/install_programs
index 51e08019dd..8d89cd9984 100755
--- a/install_programs
+++ b/install_programs
@@ -33,6 +33,9 @@ do
 	--flag-no-install-symlinks-fallback=*)
 		NO_INSTALL_SYMLINKS_FALLBACK="${1#--flag-no-install-symlinks-fallback=}"
 		;;
+	--flag-no-install-builtin-execdir-aliases=*)
+		NO_INSTALL_BUILTIN_EXECDIR_ALIASES="${1#--flag-no-install-builtin-execdir-aliases=}"
+		;;
 	--list-bindir-standalone=*)
 		list_bindir_standalone="${1#--list-bindir-standalone=}"
 		;;
@@ -54,7 +57,7 @@ do
 	shift
 done &&
 
-if test "$bindir/" != "$execdir/"
+if test "$bindir/" != "$execdir/" -a -z "$NO_INSTALL_BUILTIN_EXECDIR_ALIASES"
 then
 	for p in $list_bindir_standalone; do
 		$RM "$execdir/$p" &&
@@ -87,20 +90,23 @@ do
 	fi
 done &&
 
-for p in $list_execdir_git_dashed; do
-	$RM "$execdir/$p" &&
-	if test -n "$INSTALL_SYMLINKS" -a -n "$NO_INSTALL_SYMLINKS_FALLBACK"
-	then
-		ln -s "$destdir_from_execdir/$bindir_relative/git$X" "$execdir/$p"
-	else
-		test -n "$INSTALL_SYMLINKS" &&
-		ln -s "$destdir_from_execdir/$bindir_relative/git$X" "$execdir/$p" ||
-		{ test -z "$NO_INSTALL_HARDLINKS" &&
-		  ln "$execdir/git$X" "$execdir/$p" ||
-		  ln -s "git$X" "$execdir/$p" ||
-		  cp "$execdir/git$X" "$execdir/$p" || exit; }
-	fi
-done &&
+if test -z "$NO_INSTALL_BUILTIN_EXECDIR_ALIASES"
+then
+	for p in $list_execdir_git_dashed; do
+		$RM "$execdir/$p" &&
+		if test -n "$INSTALL_SYMLINKS" -a -n "$NO_INSTALL_SYMLINKS_FALLBACK"
+		then
+			ln -s "$destdir_from_execdir/$bindir_relative/git$X" "$execdir/$p"
+		else
+			test -n "$INSTALL_SYMLINKS" &&
+			ln -s "$destdir_from_execdir/$bindir_relative/git$X" "$execdir/$p" ||
+			{ test -z "$NO_INSTALL_HARDLINKS" &&
+			  ln "$execdir/git$X" "$execdir/$p" ||
+			  ln -s "git$X" "$execdir/$p" ||
+			  cp "$execdir/git$X" "$execdir/$p" || exit; }
+		fi
+	done
+fi &&
 
 for p in $list_execdir_curl_aliases; do
 	$RM "$execdir/$p" &&
-- 
2.19.1.930.g4563a0d9d0
Previous: Eric SunshineNext: Eric Sunshine
Message 41 of 53 in “What's cooking in git.git (Mar 2018, #02; Tue, 6)”
  1. Junio C HamanoMar 6, 2018
  2. Johannes SchindelinMar 7, 2018
  3. Ævar Arnfjörð BjarmasonMar 8, 2018
  4. Daniel JacquesMar 8, 2018
  5. Why don't we symlink libexec/git-core/* to bin/git?Ævar Arnfjörð Bjarmason, Mar 13, 2018
  6. Junio C HamanoMar 13, 2018
  7. Randall S. BeckerMar 13, 2018
  8. 0/3 Makefile: add a INSTALL_SYMLINKS optionÆvar Arnfjörð Bjarmason, Mar 13, 2018
  9. 1/3 Makefile: fix broken bindir_relative variableÆvar Arnfjörð Bjarmason, Mar 13, 2018
  10. 3/3 Makefile: optionally symlink libexec/git-core binaries to bin/gitÆvar Arnfjörð Bjarmason, Mar 13, 2018
  11. Johannes SixtMar 14, 2018
  12. Ævar Arnfjörð BjarmasonMar 14, 2018
  13. Linus TorvaldsMar 14, 2018
  14. Johannes SchindelinMar 15, 2018
  15. Linus TorvaldsMar 15, 2018
  16. Johannes SchindelinMar 16, 2018
  17. Ævar Arnfjörð BjarmasonMar 16, 2018
  18. Johannes SchindelinMar 19, 2018
  19. Linus TorvaldsMar 19, 2018
  20. 0/5 stop installing old libexec aliases like "git-init"Ævar Arnfjörð Bjarmason, Nov 2, 2018
  21. Junio C HamanoNov 3, 2018
  22. Ævar Arnfjörð BjarmasonNov 5, 2018
  23. Johannes SchindelinNov 12, 2018
  24. Ævar Arnfjörð BjarmasonNov 16, 2018
  25. Michael HaggertyNov 16, 2018
  26. Ævar Arnfjörð BjarmasonNov 16, 2018
  27. Jeff KingNov 17, 2018
  28. Johannes SchindelinNov 22, 2018
  29. Jeff KingNov 22, 2018
  30. Johannes SchindelinNov 23, 2018
  31. 1/5 Makefile: move long inline shell loops in "install" into helperÆvar Arnfjörð Bjarmason, Nov 2, 2018
  32. Eric SunshineNov 4, 2018
  33. Johannes SchindelinNov 12, 2018
  34. Ævar Arnfjörð BjarmasonNov 12, 2018
  35. Johannes SchindelinNov 12, 2018
  36. Ævar Arnfjörð BjarmasonNov 16, 2018
  37. 2/5 Makefile: conform some of the code to our coding standardsÆvar Arnfjörð Bjarmason, Nov 2, 2018
  38. 3/5 Makefile: stop hiding failures during "install"Ævar Arnfjörð Bjarmason, Nov 2, 2018
  39. 4/5 Makefile: add NO_INSTALL_SYMLINKS_FALLBACK switchÆvar Arnfjörð Bjarmason, Nov 2, 2018
  40. Eric SunshineNov 4, 2018
  41. 5/5 Makefile: Add a NO_INSTALL_BUILTIN_EXECDIR_ALIASES flagÆvar Arnfjörð Bjarmason, Nov 2, 2018
  42. Eric SunshineNov 4, 2018
  43. Johannes SchindelinNov 12, 2018
  44. Johannes SchindelinMar 15, 2018
  45. 2/3 Makefile: add a gitexecdir_relative variableÆvar Arnfjörð Bjarmason, Mar 13, 2018
  46. Ævar Arnfjörð BjarmasonMar 14, 2018
  47. Junio C HamanoMar 14, 2018
  48. Johannes SchindelinMar 15, 2018
  49. Duy NguyenMar 16, 2018
  50. Johannes SchindelinMar 30, 2018
  51. Martin ÅgrenMar 9, 2018
  52. Duy NguyenMar 9, 2018
  53. Junio C HamanoMar 9, 2018

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.