[Top][All Lists]

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

Re: smerge autolaunch integration for conflicts in git

From: Lawrence Mitchell
Subject: Re: smerge autolaunch integration for conflicts in git
Date: Wed, 13 Aug 2014 16:07:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin)

Eric S. Raymond wrote:


> Good news: I merged it anyway because if it breaks, it's not going to
> do so seriously and should be easy to fix.  Multiple git adds on a
> file are harmless.  The most likely failure is that the regexp for
> detecting conflicts in a status listing is slightly off, in which case
> the launch hook will simply not fire.

A better way to do this is to use git ls-files.  For example:

git ls-files -u -z -- directory

gives you the unmerged files in directory (paths
NUL-separated) with each file repeated 3 times

So something like the following gives you the unmerged files:

(let ((lines (split-string (vc-git--run-command-string directory
                            "ls-files" "-u" "-z" "--")
                           "\0" 'omit-nulls)))
 (loop for line in lines
       for i = 0 then (+ i 1)
       ;; Prefix is:
       ;; 6 chars for mode
       ;; 1 space
       ;; 40 chars for SHA1
       ;; 1 space
       ;; 1 char for state
       ;; 1 tab
       ;; filename
       if (zerop (mod i 3)) collect (substring line 50)))


Lawrence Mitchell <address@hidden>

reply via email to

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