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

Previous Next

Package: emacs;

Reported by: Rasmus <rasmus <at> gmx.us>

Date: Wed, 3 Sep 2014 00:12:02 UTC

Severity: normal

Tags: patch

Found in version 24.4.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18391 in the body.
You can then email your comments to 18391 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18391; Package emacs. (Wed, 03 Sep 2014 00:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rasmus <rasmus <at> gmx.us>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 03 Sep 2014 00:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rasmus <rasmus <at> gmx.us>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4.50; [patch] vc-git-conflicted-files and empty git status 
Date: Wed, 03 Sep 2014 01:57:53 +0200
[Message part 1 (text/plain, inline)]
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 <esr <at> thyrsus.com>
     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: dmantipov <at> yandex.ru-20140825070042-1o6sutsne8cexjdb
Windowing system distributor `The X.Org Foundation', version 11.0.11600000
System Description:	Arch Linux

-- 
Er du tosset for noge' lårt!
[fix-vc-git-conflict.patch (text/x-diff, inline)]
=== 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  <emacs <at> pank.eu>
+
+ 	* vc/vc-git.el (vc-git-conflicted-files): Fix bug when git status
+ 	returns nil.
+
  2014-08-25  Christoph Scholtes  <cschol2112 <at> gmail.com>

  	* 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 sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Thu, 04 Sep 2014 16:36:02 GMT) Full text and rfc822 format available.

Notification sent to Rasmus <rasmus <at> gmx.us>:
bug acknowledged by developer. (Thu, 04 Sep 2014 16:36:02 GMT) Full text and rfc822 format available.

Message #10 received at 18391-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Rasmus <rasmus <at> gmx.us>
Cc: 18391-done <at> debbugs.gnu.org
Subject: Re: bug#18391: 24.4.50; [patch] vc-git-conflicted-files and empty git
 status
Date: Thu, 04 Sep 2014 12:35:38 -0400
> The attach patch addresses this by checking that git status did in
> fact returned non-nil.

Thanks, installed (tho I removed the `when lines' test since dolist will
already do nothing if lines is nil).


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 03 Oct 2014 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 341 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.