{"thread":{"id":"30024","subject":"[PATCH] Locate git helpers with type -P, for when git --exec-path is multivalued","startedAt":"2012-03-22T09:06:59Z","lastAt":"2012-03-22T10:24:54Z","messageCount":4,"participants":["Dominique Quatravaux","Thomas Rast","Andreas Schwab"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"187450","messageId":"1332407219-7774-1-git-send-email-domq@google.com","threadId":"30024","inReplyTo":null,"subject":"[PATCH] Locate git helpers with type -P, for when git --exec-path is multivalued","fromName":"Dominique Quatravaux","fromEmail":"domq@google.com","sentAt":"2012-03-22T09:06:59Z","receivedAt":"2012-03-22T09:06:59Z","isPatch":true,"sender":{"key":"domq@google.com","avatar":"https://gravatar.com/avatar/121b20f85f75e3366ecd70be7f2777189ed53d0cc5472531cde13e4ed9e4f61e?d=mp&s=160"},"body":"Under a setting of (eg) GIT_EXEC_PATH=/home/joe/bin:/usr/lib/git-core,\nconstructs such as\n\n  . \"$(git --exec-path)\"/git-sh-setup\n\ndo not work. The proper way is\n\n  . \"$(PATH=\"$(git --exec-path)\" type -p git-sh-setup)\"\n---\n Documentation/git-mergetool--lib.txt |    3 ++-\n Documentation/git-parse-remote.txt   |    2 +-\n Documentation/git-sh-i18n.txt        |    2 +-\n Documentation/git-sh-setup.txt       |    2 +-\n contrib/diffall/git-diffall          |    4 ++--\n git-mergetool--lib.sh                |    2 +-\n 6 files changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-mergetool--lib.txt b/Documentation/git-mergetool--lib.txt\nindex f98a41b..c7188d3 100644\n--- a/Documentation/git-mergetool--lib.txt\n+++ b/Documentation/git-mergetool--lib.txt\n@@ -8,7 +8,8 @@ git-mergetool--lib - Common git merge tool shell scriptlets\n SYNOPSIS\n --------\n [verse]\n-'TOOL_MODE=(diff|merge) . \"$(git --exec-path)/git-mergetool{litdd}lib\"'\n+'TOOL_MODE=(diff|merge) \\\n+  . \"$(PATH=\"$(git --exec-path)\" type -P git-mergetool{litdd}lib)\"'\n \n DESCRIPTION\n -----------\ndiff --git a/Documentation/git-parse-remote.txt b/Documentation/git-parse-remote.txt\nindex a45ea1e..c17d7b8 100644\n--- a/Documentation/git-parse-remote.txt\n+++ b/Documentation/git-parse-remote.txt\n@@ -9,7 +9,7 @@ git-parse-remote - Routines to help parsing remote repository access parameters\n SYNOPSIS\n --------\n [verse]\n-'. \"$(git --exec-path)/git-parse-remote\"'\n+'. \"$(PATH=\"$(git --exec-path)\" type -P git-parse-remote)\"'\n \n DESCRIPTION\n -----------\ndiff --git a/Documentation/git-sh-i18n.txt b/Documentation/git-sh-i18n.txt\nindex 60cf49c..f74820c 100644\n--- a/Documentation/git-sh-i18n.txt\n+++ b/Documentation/git-sh-i18n.txt\n@@ -8,7 +8,7 @@ git-sh-i18n - Git's i18n setup code for shell scripts\n SYNOPSIS\n --------\n [verse]\n-'. \"$(git --exec-path)/git-sh-i18n\"'\n+'. \"$(PATH=\"$(git --exec-path)\" type -P git-sh-i18n)\"'\n \n DESCRIPTION\n -----------\ndiff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt\nindex 5e5f1c8..44c6aa9 100644\n--- a/Documentation/git-sh-setup.txt\n+++ b/Documentation/git-sh-setup.txt\n@@ -8,7 +8,7 @@ git-sh-setup - Common git shell script setup code\n SYNOPSIS\n --------\n [verse]\n-'. \"$(git --exec-path)/git-sh-setup\"'\n+'. \"$(PATH=\"$(git --exec-path)\" type -P git-sh-setup)\"'\n \n DESCRIPTION\n -----------\ndiff --git a/contrib/diffall/git-diffall b/contrib/diffall/git-diffall\nindex 84f2b65..451ca98 100755\n--- a/contrib/diffall/git-diffall\n+++ b/contrib/diffall/git-diffall\n@@ -22,10 +22,10 @@ USAGE='[--cached] [--copy-back] [-x|--extcmd=<command>] <commit>{0,2} [-- <path>\n '\n \n SUBDIRECTORY_OK=1\n-. \"$(git --exec-path)/git-sh-setup\"\n+PATH=\"$(PATH=\"$(git --exec-path)\" type -P git-sh-setup)\"\n \n TOOL_MODE=diff\n-. \"$(git --exec-path)/git-mergetool--lib\"\n+. \"$(PATH=\"$(git --exec-path)\" type -P git-mergetool--lib)\"\n \n merge_tool=\"$(get_merge_tool)\"\n if test -z \"$merge_tool\"\ndiff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh\nindex ed630b2..73d8510 100644\n--- a/git-mergetool--lib.sh\n+++ b/git-mergetool--lib.sh\n@@ -52,7 +52,7 @@ setup_tool () {\n \t\ttool=\"$1\"\n \t\t;;\n \tesac\n-\tmergetools=\"$(git --exec-path)/mergetools\"\n+\tmergetools=\"$(PATH=\"$(git --exec-path)\" type -P mergetools)\"\n \n \t# Load the default definitions\n \t. \"$mergetools/defaults\"\n-- \n1.7.7.3\n"},{"id":"187451","messageId":"87pqc5ged3.fsf@thomas.inf.ethz.ch","threadId":"30024","inReplyTo":"1332407219-7774-1-git-send-email-domq@google.com","subject":"Re: [PATCH] Locate git helpers with type -P, for when git --exec-path is multivalued","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2012-03-22T09:43:36Z","receivedAt":"2012-03-22T09:43:36Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Dominique Quatravaux <domq@google.com> writes:\n\n> Under a setting of (eg) GIT_EXEC_PATH=/home/joe/bin:/usr/lib/git-core,\n> constructs such as\n>\n>   . \"$(git --exec-path)\"/git-sh-setup\n>\n> do not work. The proper way is\n>\n>   . \"$(PATH=\"$(git --exec-path)\" type -p git-sh-setup)\"\n\nNAK.  The documented(!) way of loading git-sh-setup is\n\n  . \"$(git --exec-path)/git-sh-setup\"\n\nand we can't break that.  I don't know where you are getting your\nmultivalued GIT_EXEC_PATH from, but there are other places in the code\nthat assume a single path, too.  For example, the callchain (irrelevant\nstuff snipped)\n\nvoid setup_path(void)\n{\n\tadd_path(&new_path, git_exec_path());\n}\n\nstatic void add_path(struct strbuf *out, const char *path)\n{\n\tif (path && *path) {\n\t\tif (is_absolute_path(path))\n\t\t\tstrbuf_addstr(out, path);\n\t\telse\n\t\t\tstrbuf_addstr(out, absolute_path(path));\n\n\t\tstrbuf_addch(out, PATH_SEP);\n        }\n}\n\nmakes no sense at is_absolute_path(path) if path is multivalued.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"187452","messageId":"m262dxrmr2.fsf@igel.home","threadId":"30024","inReplyTo":"1332407219-7774-1-git-send-email-domq@google.com","subject":"Re: [PATCH] Locate git helpers with type -P, for when git --exec-path is multivalued","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-03-22T09:46:57Z","receivedAt":"2012-03-22T09:46:57Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Dominique Quatravaux <domq@google.com> writes:\n\n> Under a setting of (eg) GIT_EXEC_PATH=/home/joe/bin:/usr/lib/git-core,\n> constructs such as\n>\n>   . \"$(git --exec-path)\"/git-sh-setup\n>\n> do not work. The proper way is\n>\n>   . \"$(PATH=\"$(git --exec-path)\" type -p git-sh-setup)\"\n\ntype doesn't take any options in POSIX, and -P is bash-only.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"187454","messageId":"CAJh6GrH9NAQ5=zHE-nrCj3b1NvJUaaenNzTmvon5Ut2XaS1dsg@mail.gmail.com","threadId":"30024","inReplyTo":"87pqc5ged3.fsf@thomas.inf.ethz.ch","subject":"Re: [PATCH] Locate git helpers with type -P, for when git --exec-path is multivalued","fromName":"Dominique Quatravaux","fromEmail":"domq@google.com","sentAt":"2012-03-22T10:24:54Z","receivedAt":"2012-03-22T10:24:54Z","isPatch":true,"sender":{"key":"domq@google.com","avatar":"https://gravatar.com/avatar/121b20f85f75e3366ecd70be7f2777189ed53d0cc5472531cde13e4ed9e4f61e?d=mp&s=160"},"body":"On Thu, Mar 22, 2012 at 10:43 AM, Thomas Rast <trast@student.ethz.ch> wrote:\n> I don't know where you are getting your\n> multivalued GIT_EXEC_PATH from,\n\nWell it used to work for me before, apparently not by design... Too bad.\n\n-- \n  Dominique Quatravaux\n  +41 79 609 40 72\n"}]}