diff mbox series

[19/30] subtree: give `$(git --exec-path)` precedence over `$PATH`

Message ID 20210423194230.1388945-20-lukeshu@lukeshu.com (mailing list archive)
State Superseded
Headers show
Series subtree: clean up, improve UX | expand

Commit Message

Luke Shumaker April 23, 2021, 7:42 p.m. UTC
From: Luke Shumaker <lukeshu@datawire.io>

Other Git commands implemented in shell give `git --exec-path`
precedence over the existing $PATH, but subtree gives the existing $PATH
precedence.  Flip subtree's PATH around to match what other commands do.

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
---
 contrib/subtree/git-subtree.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ævar Arnfjörð Bjarmason April 26, 2021, 8:27 a.m. UTC | #1
On Fri, Apr 23 2021, Luke Shumaker wrote:

> From: Luke Shumaker <lukeshu@datawire.io>
>
> Other Git commands implemented in shell give `git --exec-path`
> precedence over the existing $PATH, but subtree gives the existing $PATH
> precedence.  Flip subtree's PATH around to match what other commands do.
>
> Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
> ---
>  contrib/subtree/git-subtree.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index 3105eb8033..9d365c9f2f 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -28,7 +28,7 @@ rejoin        merge the new branch back into HEAD
>  squash        merge subtree changes as a single commit
>  "
>  
> -PATH=$PATH:$(git --exec-path)
> +PATH=$(git --exec-path):$PATH

The history of git-subtree.sh suggests that instead of this change we'd
be better of removing this PATH assignment, and then later doing:

    . "$(git --exec-path)/git-sh-setup"

Isn't that closer to what git-subtree.sh wants here?
diff mbox series

Patch

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 3105eb8033..9d365c9f2f 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -28,7 +28,7 @@  rejoin        merge the new branch back into HEAD
 squash        merge subtree changes as a single commit
 "
 
-PATH=$PATH:$(git --exec-path)
+PATH=$(git --exec-path):$PATH
 
 arg_debug=
 arg_command=