unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18391: 24.4.50; [patch] vc-git-conflicted-files and empty git status
@ 2014-09-02 23:57 Rasmus
  2014-09-04 16:35 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus @ 2014-09-02 23:57 UTC (permalink / raw)
  To: 18391

[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]

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@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@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!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-vc-git-conflict.patch --]
[-- Type: text/x-diff, Size: 2242 bytes --]

=== 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@pank.eu>
+
+ 	* vc/vc-git.el (vc-git-conflicted-files): Fix bug when git status
+ 	returns nil.
+
  2014-08-25  Christoph Scholtes  <cschol2112@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."

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#18391: 24.4.50; [patch] vc-git-conflicted-files and empty git status
  2014-09-02 23:57 bug#18391: 24.4.50; [patch] vc-git-conflicted-files and empty git status Rasmus
@ 2014-09-04 16:35 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2014-09-04 16:35 UTC (permalink / raw)
  To: Rasmus; +Cc: 18391-done

> 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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-04 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-02 23:57 bug#18391: 24.4.50; [patch] vc-git-conflicted-files and empty git status Rasmus
2014-09-04 16:35 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).