From: Dominique Quatravaux <domq@google.com>
To: git@vger.kernel.org
Cc: Dominique Quatravaux <domq@google.com>
Subject: [PATCH] Locate git helpers with type -P, for when git --exec-path is multivalued
Date: Thu, 22 Mar 2012 10:06:59 +0100 [thread overview]
Message-ID: <1332407219-7774-1-git-send-email-domq@google.com> (raw)
Under a setting of (eg) GIT_EXEC_PATH=/home/joe/bin:/usr/lib/git-core,
constructs such as
. "$(git --exec-path)"/git-sh-setup
do not work. The proper way is
. "$(PATH="$(git --exec-path)" type -p git-sh-setup)"
---
Documentation/git-mergetool--lib.txt | 3 ++-
Documentation/git-parse-remote.txt | 2 +-
Documentation/git-sh-i18n.txt | 2 +-
Documentation/git-sh-setup.txt | 2 +-
contrib/diffall/git-diffall | 4 ++--
git-mergetool--lib.sh | 2 +-
6 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-mergetool--lib.txt b/Documentation/git-mergetool--lib.txt
index f98a41b..c7188d3 100644
--- a/Documentation/git-mergetool--lib.txt
+++ b/Documentation/git-mergetool--lib.txt
@@ -8,7 +8,8 @@ git-mergetool--lib - Common git merge tool shell scriptlets
SYNOPSIS
--------
[verse]
-'TOOL_MODE=(diff|merge) . "$(git --exec-path)/git-mergetool{litdd}lib"'
+'TOOL_MODE=(diff|merge) \
+ . "$(PATH="$(git --exec-path)" type -P git-mergetool{litdd}lib)"'
DESCRIPTION
-----------
diff --git a/Documentation/git-parse-remote.txt b/Documentation/git-parse-remote.txt
index a45ea1e..c17d7b8 100644
--- a/Documentation/git-parse-remote.txt
+++ b/Documentation/git-parse-remote.txt
@@ -9,7 +9,7 @@ git-parse-remote - Routines to help parsing remote repository access parameters
SYNOPSIS
--------
[verse]
-'. "$(git --exec-path)/git-parse-remote"'
+'. "$(PATH="$(git --exec-path)" type -P git-parse-remote)"'
DESCRIPTION
-----------
diff --git a/Documentation/git-sh-i18n.txt b/Documentation/git-sh-i18n.txt
index 60cf49c..f74820c 100644
--- a/Documentation/git-sh-i18n.txt
+++ b/Documentation/git-sh-i18n.txt
@@ -8,7 +8,7 @@ git-sh-i18n - Git's i18n setup code for shell scripts
SYNOPSIS
--------
[verse]
-'. "$(git --exec-path)/git-sh-i18n"'
+'. "$(PATH="$(git --exec-path)" type -P git-sh-i18n)"'
DESCRIPTION
-----------
diff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt
index 5e5f1c8..44c6aa9 100644
--- a/Documentation/git-sh-setup.txt
+++ b/Documentation/git-sh-setup.txt
@@ -8,7 +8,7 @@ git-sh-setup - Common git shell script setup code
SYNOPSIS
--------
[verse]
-'. "$(git --exec-path)/git-sh-setup"'
+'. "$(PATH="$(git --exec-path)" type -P git-sh-setup)"'
DESCRIPTION
-----------
diff --git a/contrib/diffall/git-diffall b/contrib/diffall/git-diffall
index 84f2b65..451ca98 100755
--- a/contrib/diffall/git-diffall
+++ b/contrib/diffall/git-diffall
@@ -22,10 +22,10 @@ USAGE='[--cached] [--copy-back] [-x|--extcmd=<command>] <commit>{0,2} [-- <path>
'
SUBDIRECTORY_OK=1
-. "$(git --exec-path)/git-sh-setup"
+PATH="$(PATH="$(git --exec-path)" type -P git-sh-setup)"
TOOL_MODE=diff
-. "$(git --exec-path)/git-mergetool--lib"
+. "$(PATH="$(git --exec-path)" type -P git-mergetool--lib)"
merge_tool="$(get_merge_tool)"
if test -z "$merge_tool"
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index ed630b2..73d8510 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -52,7 +52,7 @@ setup_tool () {
tool="$1"
;;
esac
- mergetools="$(git --exec-path)/mergetools"
+ mergetools="$(PATH="$(git --exec-path)" type -P mergetools)"
# Load the default definitions
. "$mergetools/defaults"
--
1.7.7.3
next reply other threads:[~2012-03-22 9:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-22 9:06 Dominique Quatravaux [this message]
2012-03-22 9:43 ` [PATCH] Locate git helpers with type -P, for when git --exec-path is multivalued Thomas Rast
2012-03-22 10:24 ` Dominique Quatravaux
2012-03-22 9:46 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1332407219-7774-1-git-send-email-domq@google.com \
--to=domq@google.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).