bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18391: 24.4.50; [patch] vc-git-conflicted-files and empty git status


From: Rasmus
Subject: bug#18391: 24.4.50; [patch] vc-git-conflicted-files and empty git status
Date: Wed, 03 Sep 2014 01:57:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Hi,

[I tried to send this report earlier, though it seems something went
 wrong.  If it did already show up: sorry about the noise].

Recently, I get an error every time I open a new file in my document
folder due to `vc-git-conflicted-files'.  The function was introduced
in

     revno: 117697
     committer: Eric S. Raymond <address@hidden>
     branch nick: trunk
     timestamp: Wed 2014-08-13 04:05:45 -0400
     message:
       Integrate Rüdiger Sonderfeld's code for detecting 
       conflicted files under git.

Background: My document folder is stored in a git annex direct-mode
folder (see http://git-annex.branchable.com/).  git annex is used for
keeping folders in sync across computers, and is build on top of git.
In my particular setup (direct mode) "git status" returns nil (or an
empty string).  However, `vc-git-conflicted-files' expects it to
return a non-trivial string.

The attach patch addresses this by checking that git status did in
fact returned non-nil.

Please let me know (preferably with wide reply) if you want me to fix
the problem in some other way.

I have signed papers to FSF.

Thanks,
Rasmus

In GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)
 of 2014-08-25 on W530
Repository revision: address@hidden
Windowing system distributor `The X.Org Foundation', version 11.0.11600000
System Description:     Arch Linux

-- 
Er du tosset for noge' lårt!
=== modified file 'lisp/ChangeLog'
*** lisp/ChangeLog      2014-08-25 03:16:36 +0000
--- lisp/ChangeLog      2014-08-25 23:12:30 +0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2014-08-25  Rasmus Pank Roulund  <address@hidden>
+
+       * vc/vc-git.el (vc-git-conflicted-files): Fix bug when git status
+       returns nil.
+
  2014-08-25  Christoph Scholtes  <address@hidden>

        * subr.el (remq): Fix docstring (Bug#18253).

=== modified file 'lisp/vc/vc-git.el'
*** lisp/vc/vc-git.el   2014-08-13 08:42:33 +0000
--- lisp/vc/vc-git.el   2014-08-25 22:59:45 +0000
*************** This prompts for a branch to merge from.
*** 774,790 ****
    "Return the list of files with conflicts in DIRECTORY."
    (let* ((status
            (vc-git--run-command-string directory "status" "--porcelain" "--"))
!          (lines (split-string status "\n" 'omit-nulls))
           files)
!     (dolist (line lines files)
!       (when (string-match "\\([ MADRCU?!][ MADRCU?!]\\) \\(.+\\)\\(?: -> 
\\(.+\\)\\)?"
!                           line)
!         (let ((state (match-string 1 line))
!               (file (match-string 2 line)))
!           ;; See git-status(1).
!           (when (member state '("AU" "UD" "UA" ;; "DD"
!                                 "DU" "AA" "UU"))
!             (push file files)))))))

  (defun vc-git-resolve-when-done ()
    "Call \"git add\" if the conflict markers have been removed."
--- 774,791 ----
    "Return the list of files with conflicts in DIRECTORY."
    (let* ((status
            (vc-git--run-command-string directory "status" "--porcelain" "--"))
!          (lines (when status (split-string status "\n" 'omit-nulls)))
           files)
!     (when lines
!         (dolist (line lines files)
!           (when (string-match "\\([ MADRCU?!][ MADRCU?!]\\) \\(.+\\)\\(?: -> 
\\(.+\\)\\)?"
!                               line)
!             (let ((state (match-string 1 line))
!                   (file (match-string 2 line)))
!               ;; See git-status(1).
!               (when (member state '("AU" "UD" "UA" ;; "DD"
!                                     "DU" "AA" "UU"))
!                 (push file files))))))))

  (defun vc-git-resolve-when-done ()
    "Call \"git add\" if the conflict markers have been removed."

reply via email to

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