[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 05b0d99d71: Consider Git's exec path when searc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 05b0d99d71: Consider Git's exec path when searching for extensions |
Date: |
Sun, 13 Nov 2022 17:58:44 -0500 (EST) |
branch: elpa/git-commit
commit 05b0d99d714350d51676b86da9f5daa2f6b7fa3e
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>
Consider Git's exec path when searching for extensions
Commands that depend on optional third-party Git extensions use
executable-find to check whether the extension is available. That
misses the legitimate case where an extension is installed in Git's
exec path rather than a directory in $PATH.
Update these spots to call a new helper that looks in Git's exec path
before calling executable-find. Note that the order is chosen to
follow Git's precedence (though that doesn't matter for any of the
current callers because they don't use the return value).
Closes #4812.
---
docs/RelNotes/3.4.0.org | 4 ++++
lisp/magit-commit.el | 4 ++--
lisp/magit-git.el | 13 +++++++++++++
lisp/magit-log.el | 2 +-
4 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/docs/RelNotes/3.4.0.org b/docs/RelNotes/3.4.0.org
index 42ea3fa3cd..9169af1675 100644
--- a/docs/RelNotes/3.4.0.org
+++ b/docs/RelNotes/3.4.0.org
@@ -174,6 +174,10 @@ b1ad283941 #4526 magit-version: more compatible fix for
#4511
- A diff header added in a new Git release wasn't handled yet. #4531
+- Commands that use optional third-party Git extensions didn't
+ consider that extension executables may be installed in Git's exec
+ path instead of a directory in ~exec-path~. #4812
+
- Fixed calculation of gravatar image size. ecfaa325a3
a14f847d97 magit-branch-checkout: Refresh after all configuration took place
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index c85206567d..03be34be96 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -463,7 +463,7 @@ See `magit-commit-autofixup' for an alternative
implementation."
(transient-args 'magit-commit-absorb))))
(if (eq phase 'transient)
(transient-setup 'magit-commit-absorb)
- (unless (compat-executable-find "git-absorb" t)
+ (unless (magit-git-executable-find "git-absorb")
(user-error "This command requires the git-absorb executable, which %s"
"is available from https://github.com/tummychow/git-absorb"))
(unless (magit-anything-staged-p)
@@ -506,7 +506,7 @@ See `magit-commit-absorb' for an alternative
implementation."
(transient-args 'magit-commit-autofixup))))
(if (eq phase 'transient)
(transient-setup 'magit-commit-autofixup)
- (unless (compat-executable-find "git-autofixup" t)
+ (unless (magit-git-executable-find "git-autofixup")
(user-error "This command requires the git-autofixup script, which %s"
"is available from
https://github.com/torbiak/git-autofixup"))
(unless (magit-anything-modified-p)
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 641bbc317b..502b5f0e73 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -582,6 +582,19 @@ call function WASHER with ARGS as its sole argument."
(magit-cancel-section))
(magit-maybe-make-margin-overlay))))
+(defun magit-git-executable-find (command)
+ "Search for COMMAND in Git's exec path, falling back to `exec-path'.
+Like `executable-find', return the absolute file name of the
+executable."
+ (or (locate-file command
+ (list (concat
+ (file-remote-p default-directory)
+ (or (magit-git-string "--exec-path")
+ (error "`git --exec-path' failed"))))
+ exec-suffixes
+ #'file-executable-p)
+ (compat-executable-find command t)))
+
;;; Git Version
(defconst magit--git-version-regexp
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 95290d5d6d..eac0536d00 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -826,7 +826,7 @@ https://github.com/mhagger/git-when-merged."
(list commit
(magit-read-other-branch "Merged into" commit)))
(magit-log-arguments)))
- (unless (compat-executable-find "git-when-merged" t)
+ (unless (magit-git-executable-find "git-when-merged")
(user-error "This command requires git-when-merged (%s)"
"https://github.com/mhagger/git-when-merged"))
(let (exit m)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/git-commit 05b0d99d71: Consider Git's exec path when searching for extensions,
ELPA Syncer <=