all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: 18391@debbugs.gnu.org
Subject: bug#18391: 24.4.50; [patch] vc-git-conflicted-files and empty git status
Date: Wed, 03 Sep 2014 01:57:53 +0200	[thread overview]
Message-ID: <877g1l60e6.fsf@gmx.us> (raw)

[-- 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."

             reply	other threads:[~2014-09-02 23:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 23:57 Rasmus [this message]
2014-09-04 16:35 ` bug#18391: 24.4.50; [patch] vc-git-conflicted-files and empty git status Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877g1l60e6.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=18391@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.