mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
vc-git-resolve-conflicts: Extend unstage-maybe to similar operations
* lisp/vc/vc-git.el (vc-git-resolve-when-done): When vc-git-resolve-conflicts is unstage-maybe, don't clear the staging area during a rebase, am, revert or cherry-pick. (vc-git-resolve-conflicts): Update docstring in light of changes to vc-git-resolve-when-done. (vc-git--cmds-in-progress): Detect reverts and cherry-pick operations in progress.
This commit is contained in:
parent
d354300993
commit
d7d5b2ec9a
@ -168,10 +168,10 @@ uses a full scan)."
|
||||
|
||||
(defcustom vc-git-resolve-conflicts t
|
||||
"When non-nil, mark conflicted file as resolved upon saving.
|
||||
That is performed after all conflict markers in it have been
|
||||
removed. If the value is `unstage-maybe', and no merge is in
|
||||
progress, then after the last conflict is resolved, also clear
|
||||
the staging area."
|
||||
That is performed after all conflict markers in it have been removed.
|
||||
If the value is `unstage-maybe', and no merge, rebase or similar
|
||||
operation is in progress, then after the last conflict is resolved, also
|
||||
clear the staging area."
|
||||
:type '(choice (const :tag "Don't resolve" nil)
|
||||
(const :tag "Resolve" t)
|
||||
(const :tag "Resolve and maybe unstage all files"
|
||||
@ -766,6 +766,10 @@ or an empty string if none."
|
||||
(let ((gitdir (vc-git--git-path))
|
||||
cmds)
|
||||
;; See contrib/completion/git-prompt.sh in git.git.
|
||||
(when (file-exists-p (expand-file-name "REVERT_HEAD" gitdir))
|
||||
(push 'revert cmds))
|
||||
(when (file-exists-p (expand-file-name "CHERRY_PICK_HEAD" gitdir))
|
||||
(push 'cherry-pick cmds))
|
||||
(when (or (file-directory-p
|
||||
(expand-file-name "rebase-merge" gitdir))
|
||||
(file-exists-p
|
||||
@ -1419,8 +1423,14 @@ This prompts for a branch to merge from."
|
||||
(vc-git-command nil 0 buffer-file-name "add")
|
||||
(unless (or
|
||||
(not (eq vc-git-resolve-conflicts 'unstage-maybe))
|
||||
;; Doing a merge, so bug#20292 doesn't apply.
|
||||
(file-exists-p (vc-git--git-path "MERGE_HEAD"))
|
||||
;; Doing a merge or rebase-like operation, so bug#20292
|
||||
;; doesn't apply.
|
||||
;;
|
||||
;; If we were to 'git reset' in the middle of a
|
||||
;; cherry-pick, for example, it would effectively abort
|
||||
;; the cherry-pick, losing the user's progress.
|
||||
(cl-intersection '(merge rebase am revert cherry-pick)
|
||||
(vc-git--cmds-in-progress))
|
||||
(vc-git-conflicted-files (vc-git-root buffer-file-name)))
|
||||
(vc-git-command nil 0 nil "reset"))
|
||||
(vc-resynch-buffer buffer-file-name t t)
|
||||
|
Loading…
Reference in New Issue
Block a user