(vc-git--run-command-string directory "status" "--porcelain" "--"))
(lines (when status (split-string status "\n" 'omit-nulls)))
files)
+ ;; TODO: Look into reimplementing `vc-git-state', as well as
+ ;; `vc-git-dir-status-files', based on this output, thus making the
+ ;; extra process call in `vc-git-find-file-hook' unnecessary.
(dolist (line lines files)
(when (string-match "\\([ MADRCU?!][ MADRCU?!]\\) \\(.+\\)\\(?: -> \\(.+\\)\\)?"
line)
(save-excursion
(goto-char (point-min))
(unless (re-search-forward "^<<<<<<< " nil t)
- (vc-git-command nil 0 buffer-file-name "add")
+ (if (file-exists-p (expand-file-name ".git/MERGE_HEAD"
+ (vc-git-root buffer-file-name)))
+ ;; Doing a merge.
+ (vc-git-command nil 0 buffer-file-name "add")
+ ;; Doing something else. Likely applying a stash (bug#20292).
+ (vc-git-command nil 0 buffer-file-name "reset"))
;; Remove the hook so that it is not called multiple times.
(remove-hook 'after-save-hook 'vc-git-resolve-when-done t))))
(vc-git-conflicted-files buffer-file-name)
(save-excursion
(goto-char (point-min))
- (and (re-search-forward "^>>>>>>> " nil 'noerror)
- ;; Stashes are tricky (bug#20292).
- (not (looking-at "Stashed changes")))))
+ (re-search-forward "^<<<<<<< " nil 'noerror)))
(vc-file-setprop buffer-file-name 'vc-state 'conflict)
(smerge-start-session)
(add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local)
(append (vc-switches 'git 'annotate)
(list rev "--" name)))))
-(declare-function vc-annotate-convert-time "vc-annotate" (time))
+(declare-function vc-annotate-convert-time "vc-annotate" (&optional time))
(defun vc-git-annotate-time ()
(and (re-search-forward "[0-9a-f]+[^()]+(.* \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\) \\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\) \\([-+0-9]+\\) +[0-9]+) " nil t)