Commit 8fcda90c authored by Kyle Meyer's avatar Kyle Meyer

Revert "While committing, diff from inside gitdir if necessary"

This reverts commit 9e0e2a24.

Fixes #2981, but reopens #2955.
parent b43de680
......@@ -331,7 +331,6 @@ depending on the value of option `magit-commit-squash-confirm'."
(condition-case nil
(let ((magit-inhibit-save-previous-winconf 'unset)
(magit-display-buffer-noselect t)
(magit-toplevel--force-fallback-to-gitdir t)
(inhibit-quit nil))
(message "Diffing changes to be committed (C-g to abort diffing)")
(funcall fn (car (magit-diff-arguments))))
......
......@@ -395,8 +395,6 @@ absolute path is returned."
(setq it (file-name-as-directory (magit-expand-git-file-name it)))
(if path (expand-file-name (convert-standard-filename path) it) it)))))
(defvar magit-toplevel--force-fallback-to-gitdir nil)
(defun magit-toplevel (&optional directory)
"Return the absolute path to the toplevel of the current repository.
......@@ -461,22 +459,14 @@ returning the truename."
(let* ((link (expand-file-name "gitdir" gitdir))
(wtree (and (file-exists-p link)
(magit-file-line link))))
(cond
((and wtree
;; Ignore .git/gitdir files that result from a
;; Git bug. See #2364.
(not (equal wtree ".git")))
;; Return the linked working tree.
(file-name-directory wtree))
(magit-toplevel--force-fallback-to-gitdir
;; `git init --separate-git-dir' doesn't set `core.worktree'.
;; Commands that have to work under such conditions and that
;; also do work properly when run in the gitdir, should bind
;; this variable. See #2955.
gitdir)
(t
(if (and wtree
;; Ignore .git/gitdir files that result from a
;; Git bug. See #2364.
(not (equal wtree ".git")))
;; Return the linked working tree.
(file-name-directory wtree)
;; Step outside the control directory to enter the working tree.
(file-name-directory (directory-file-name gitdir)))))))))))
(file-name-directory (directory-file-name gitdir))))))))))
(defmacro magit-with-toplevel (&rest body)
(declare (indent defun) (debug (body)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment