emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit 281f0c3c37: magit-commit-diff-1: Fix recent reg


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 281f0c3c37: magit-commit-diff-1: Fix recent regression in --all handling
Date: Thu, 21 Jul 2022 23:58:20 -0400 (EDT)

branch: elpa/git-commit
commit 281f0c3c377cc03f685f43c15e90be5a1fc09e75
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    magit-commit-diff-1: Fix recent regression in --all handling
    
    As of 2dfeaa68 (magit-commit-diff-1: Use different heuristics,
    2022-06-07), magit-commit-diff-1 uses magit-anything-unstaged-p when
    deciding what diff to show.  However, $GIT_DIR is the default
    directory when magit-commit-diff-1 is called, so the 'git diff'
    command used by magit-anything-unstaged-p fails with an exit code of
    128, leading to magit-anything-unstaged-p returning nil even when
    there are unstaged changes.
    
    Switch to the top-level of the working tree so that
    magit-anything-unstaged-p gives an accurate answer.
    
    Closes #4725.
---
 lisp/magit-commit.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index 79c9304490..98f9764600 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -567,7 +567,11 @@ See `magit-commit-absorb' for an alternative 
implementation."
         (arg "--cached")
         (command (magit-repository-local-get 'this-commit-command))
         (staged (magit-anything-staged-p))
-        (unstaged (magit-anything-unstaged-p))
+        (unstaged
+         ;; Escape $GIT_DIR because `magit-anything-unstaged-p'
+         ;; requires a working tree.
+         (magit-with-toplevel
+           (magit-anything-unstaged-p)))
         (squash (let ((f (magit-git-dir "rebase-merge/rewritten-pending")))
                   (and (file-exists-p f) (length (magit-file-lines f)))))
         (noalt nil))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]