GNU bug report logs - #26066
vc-git-status gives wrong result when called from outside repository

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Jonathan Ganc <jonganc@HIDDEN>; Keywords: patch; dated Sun, 12 Mar 2017 02:45:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) patch. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 24 Apr 2017 00:50:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 23 20:50:49 2017
Received: from localhost ([127.0.0.1]:36947 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1d2SDJ-0005oV-Cp
	for submit <at> debbugs.gnu.org; Sun, 23 Apr 2017 20:50:49 -0400
Received: from mail-qt0-f193.google.com ([209.85.216.193]:36068)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1d2SDH-0005o5-9l
 for 26066 <at> debbugs.gnu.org; Sun, 23 Apr 2017 20:50:47 -0400
Received: by mail-qt0-f193.google.com with SMTP id t52so18485793qtb.3
 for <26066 <at> debbugs.gnu.org>; Sun, 23 Apr 2017 17:50:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:cc:from:message-id:date:user-agent
 :mime-version:in-reply-to;
 bh=MUGWZEyZo3sYXKm3JYsOMTc3nSv/J37hwCtHzRKDizo=;
 b=AwBAInjIvT48/exqeEkDKCuGBPdTgXJetGQrBjZ+sBu+hYx/kQ52LyjfA5ObkgOfgV
 W5OVL1fi3Im8J39ocH1Tbxh2qteU4vJUAsEQL0IDRWD42aZ67ppVikMfHdXWxhL3MWXb
 YJshHl9QAzHmJWbZVBTzxmncjw/0VMyONz2OJhD9xwLWJ66oNTGjJW5CLioOHElaG9b/
 dBV93us5nU8KJSRnM5yFyoGYjCZbc0GWMaoao3hY8NbkF575aX7YwsF/zm4OUv7NUOZ7
 eeJl75UnNrZF1rO4HVNyUoBLBLRe3hhFtHeTA1z8Z4WWBOB83OcqTrOtYaxX4TMU4jLc
 yEVQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:cc:from:message-id:date
 :user-agent:mime-version:in-reply-to;
 bh=MUGWZEyZo3sYXKm3JYsOMTc3nSv/J37hwCtHzRKDizo=;
 b=DPnPdKwm+1ZtNbdm7DDo52dd4ZPC7LkYAw2ElSL2BMqbQmJE6YzcSzKXtPqKvzaIkn
 1EKnaHYpOwQkTRw3iK9n3mlqV7d/Ivg0JpggFNQNrpDax56bK/kV8At8QsEe0uHwBuok
 sA4BFGM+U67UoU2XjEdvVoBv6cKu5XV/QzZ4V0gxTHZ6T7b1d/ilH/8gF/VeS2lU5s3f
 rJudk76bSPrSZc2lYqNFjP7aqk1N/sh07N3I5ieoiA18cLS2VBCUOcgM2vxEfDvvIqON
 2kgu/QxwHGsESFxaY2+JsTyg8IDzD9+NKqNic1MgtNRON0svtAETPETxis5+vf3wjBbV
 ockA==
X-Gm-Message-State: AN3rC/5MTR3drbblERpA9OVIih+1T8SCKQyiGW90+6ASByDuGmAZ4Mg9
 pyCds+nDwsym/g==
X-Received: by 10.200.44.130 with SMTP id 2mr24795748qtw.59.1492995041420;
 Sun, 23 Apr 2017 17:50:41 -0700 (PDT)
Received: from [192.168.1.198] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id r46sm11797361qtc.1.2017.04.23.17.50.39
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 23 Apr 2017 17:50:40 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Noam Postavsky <npostavs@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
 <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
 <30d8b181-d869-de24-9c86-cc1dc6ec461b@HIDDEN>
 <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@HIDDEN>
 <01922284-4265-6510-feee-dcc7301787ad@HIDDEN>
 <cf9e7b8e-44c1-43fd-7c49-f31249ea90a5@HIDDEN>
 <CAM-tV-9ApU6RemdAfrb7AAVhVzYk=k9EntKT=6-wSfCnWo-O8A@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <7346fb37-f0b2-77dc-c227-cacfbd372775@HIDDEN>
Date: Sun, 23 Apr 2017 20:50:38 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <CAM-tV-9ApU6RemdAfrb7AAVhVzYk=k9EntKT=6-wSfCnWo-O8A@HIDDEN>
Content-Type: multipart/mixed; boundary="------------7303FD8667010B222A562449"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
Cc: 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

This is a multi-part message in MIME format.
--------------7303FD8667010B222A562449
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Thanks for the feedback!

Updated with the suggested changes.


On 04/23/2017 06:28 PM, Noam Postavsky wrote:
>> Subject: [PATCH] update vc-git
>>
>> ---
> Could you add a meaningful commit message please?  See CONTRIBUTE (under
> "Commit messages") for details of Emacs' standard format.
>
> I think the patch is basically okay now, just a few minor nitpicks below.
>
>> +(defun vc-git--git-status-to-vc-state (code-list)
>> +  "Convert a list CODE-LIST of two-letter git status strings to a vc status.
> This line is too long, I think it should be fine to shorten to just
> "Convert CODE-LIST to a vc status".  You explain the format of
> CODE-LIST in the next paragraph anyway.
>
>> +Each element of CODE-LIST comes from the first two characters of
>> +a line returned by 'git status' and should be passed in the order given by 'git status'.
> This paragraph looks unfilled, hit M-q on it.
>
>> +       ;; I have only seen this with a file that is only present in the
>> +       ;; index.  Let us call this `removed'
> Missing period.
>
>> +      (setq code-list
>> +            (mapcar (lambda (s)
>> +                      (substring s 0 2))
>> +                    (delete "" (split-string status "\0"))))
> If you pass a non-nil OMIT-NULLS parameter to split-string, the
> (delete ""...) should become unnecessary.
>
>> +      (vc-git--git-status-to-vc-state code-list))))
> I would suggest dropping the temporary code-list variable here, and
> just do
>
>        (vc-git--git-status-to-vc-state
>         (mapcar (lambda (s) (substring s 0 2))
>                 (split-string status "\0" t)))


--------------7303FD8667010B222A562449
Content-Type: text/x-patch;
 name="0001-Update-vc-git-state-to-use-git-status.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-Update-vc-git-state-to-use-git-status.patch"

From 5c123593c110323edfe357c26ee136de31c14ab8 Mon Sep 17 00:00:00 2001
From: Jonathan Ganc <jonganc@HIDDEN>
Date: Mon, 10 Apr 2017 00:38:52 -0400
Subject: [PATCH] Update vc-git-state to use 'git status'

* lisp/vc/vc-git.el (vc-git-state, vc-git--git-status-to-vc-state): Update
'vc-git-state' to use 'git status', so that 'vc-git-state' can now return
'ignored', 'conflict', or 'unregistered' if appropriate. Related to
bug#26066.
---
 lisp/vc/vc-git.el | 78 ++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 52 insertions(+), 26 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 1a3f1bf..9fb35bd 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -231,34 +231,60 @@ (defun vc-git--state-code (code)
     (?U 'edited)     ;; FIXME
     (?T 'edited)))   ;; FIXME
 
+(defun vc-git--git-status-to-vc-state (code-list)
+  "Convert CODE-LIST to a vc status.
+
+Each element of CODE-LIST comes from the first two characters of
+a line returned by 'git status' and should be passed in the order
+given by 'git status'.
+
+\(It is necessary to allow CODE-LIST to be a list because
+sometimes git status returns multiple lines, e.g. for a file that
+is removed from the index but is present in the HEAD and working
+tree.) "
+  (pcase code-list
+    ('nil 'up-to-date)
+    (`(,code)
+     (pcase code
+       ("!!" 'ignored)
+       ("??" 'unregistered)
+       ;; I have only seen this with a file that is only present in the
+       ;; index.  Let us call this `removed'.
+       ("AD" 'removed)
+       (_ (cond
+           ((string-match-p "^[ RD]+$" code) 'removed)
+           ((string-match-p "^[ M]+$" code) 'edited)
+           ((string-match-p "^[ A]+$" code) 'added)
+           ((string-match-p "^[ U]+$" code) 'conflict)
+           (t 'edited)))))
+    ;;  I know of two times when git state returns more than one element,
+    ;;  in both cases returning '("D " "??")':
+    ;;  1. when a file is removed from the index but present in the
+    ;;     HEAD and working tree
+    ;;  2. when a file A is renamed to B in the index and then back to A
+    ;;     in the working tree
+    ;;  In both these instances, `unregistered' is a reasonable response.
+    (`("D " "??") 'unregistered)
+    ;;  In other cases, let us return `edited'.
+    (_ 'edited)))
+
 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
-  ;; FIXME: This can't set 'ignored or 'conflict yet
-  ;; The 'ignored state could be detected with `git ls-files -i -o
-  ;; --exclude-standard` It also can't set 'needs-update or
-  ;; 'needs-merge. The rough equivalent would be that upstream branch
-  ;; for current branch is in fast-forward state i.e. current branch
-  ;; is direct ancestor of corresponding upstream branch, and the file
-  ;; was modified upstream.  But we can't check that without a network
-  ;; operation.
-  ;; This assumes that status is known to be not `unregistered' because
-  ;; we've been successfully dispatched here from `vc-state', that
-  ;; means `vc-git-registered' returned t earlier once.  Bug#11757
-  (let ((diff (vc-git--run-command-string
-               file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))
-    (if (and diff
-             (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0\\(.*\n.\\)?"
-                           diff))
-        (let ((diff-letter (match-string 1 diff)))
-          (if (not (match-beginning 2))
-              ;; Empty diff: file contents is the same as the HEAD
-              ;; revision, but timestamps are different (eg, file
-              ;; was "touch"ed).  Update timestamp in index:
-              (prog1 'up-to-date
-                (vc-git--call nil "add" "--refresh" "--"
-                              (file-relative-name file)))
-            (vc-git--state-code diff-letter)))
-      (if (vc-git--empty-db-p) 'added 'up-to-date))))
+  (let ((status
+         (vc-git--run-command-string file "status" "--porcelain" "-z"
+                                     "--untracked-files" "--ignored" "--")))
+    (if (null status)
+        ;; If status is nil, there was an error running git, likely because
+        ;; the file is not in a git repo.
+        'unregistered
+      ;; If this code is adapted to parse 'git status' for a directory,
+      ;; note that a renamed file takes up two null values and needs to be
+      ;; treated slightly more carefully. 
+      (vc-git--git-status-to-vc-state
+       (mapcar (lambda (s)
+                 (substring s 0 2))
+               (split-string status "\0" t))))))
+
 
 (defun vc-git-working-revision (_file)
   "Git-specific version of `vc-working-revision'."
-- 
2.9.3


--------------7303FD8667010B222A562449--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 23 Apr 2017 22:45:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 23 18:45:27 2017
Received: from localhost ([127.0.0.1]:36894 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1d2QFz-0000XX-IF
	for submit <at> debbugs.gnu.org; Sun, 23 Apr 2017 18:45:27 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:52483)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1d2QFx-0000X9-Gq
 for 26066 <at> debbugs.gnu.org; Sun, 23 Apr 2017 18:45:26 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0DXHQA+Lf1Y//TvSC1cHAEBBAEBCgEBg1SFBoVZhX2RHAGXSRyGAgQCAoQLRRMBAgEBAQEBAQFrKIUWBlYjEAsOJhIUGA0kii+uCosTAQEBAQEFAiaIMIMZijwBBJ1BlG4BiHyGcpQZNyCBBiYdCC2HSCSJawEBAQ
X-IPAS-Result: A0DXHQA+Lf1Y//TvSC1cHAEBBAEBCgEBg1SFBoVZhX2RHAGXSRyGAgQCAoQLRRMBAgEBAQEBAQFrKIUWBlYjEAsOJhIUGA0kii+uCosTAQEBAQEFAiaIMIMZijwBBJ1BlG4BiHyGcpQZNyCBBiYdCC2HSCSJawEBAQ
X-IronPort-AV: E=Sophos;i="5.37,241,1488862800"; d="scan'208";a="309110755"
Received: from 45-72-239-244.cpe.teksavvy.com (HELO ceviche.home)
 ([45.72.239.244])
 by smtp.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA;
 23 Apr 2017 18:45:19 -0400
Received: by ceviche.home (Postfix, from userid 20848)
 id E2B10662F7; Sun, 23 Apr 2017 18:45:18 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
Message-ID: <jwvh91eoiaj.fsf-monnier+emacsbugs@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
 <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
 <30d8b181-d869-de24-9c86-cc1dc6ec461b@HIDDEN>
 <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@HIDDEN>
 <01922284-4265-6510-feee-dcc7301787ad@HIDDEN>
 <cf9e7b8e-44c1-43fd-7c49-f31249ea90a5@HIDDEN>
 <CAM-tV-9ApU6RemdAfrb7AAVhVzYk=k9EntKT=6-wSfCnWo-O8A@HIDDEN>
Date: Sun, 23 Apr 2017 18:45:18 -0400
In-Reply-To: <CAM-tV-9ApU6RemdAfrb7AAVhVzYk=k9EntKT=6-wSfCnWo-O8A@HIDDEN>
 (Noam Postavsky's message of "Sun, 23 Apr 2017 18:28:04 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 26066
Cc: Jonathan Ganc <jonganc@HIDDEN>, 26066 <at> debbugs.gnu.org,
 Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

>> +                    (delete "" (split-string status "\0"))))
> If you pass a non-nil OMIT-NULLS parameter to split-string, the
> (delete ""...) should become unnecessary.

Or use "\0+".


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 23 Apr 2017 22:28:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 23 18:28:13 2017
Received: from localhost ([127.0.0.1]:36880 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1d2PzJ-0008Ik-82
	for submit <at> debbugs.gnu.org; Sun, 23 Apr 2017 18:28:13 -0400
Received: from mail-io0-f171.google.com ([209.85.223.171]:34132)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1d2PzH-0008IS-4v
 for 26066 <at> debbugs.gnu.org; Sun, 23 Apr 2017 18:28:11 -0400
Received: by mail-io0-f171.google.com with SMTP id a103so167415241ioj.1
 for <26066 <at> debbugs.gnu.org>; Sun, 23 Apr 2017 15:28:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:sender:in-reply-to:references:from:date:message-id
 :subject:to:cc;
 bh=eYT/mLbIULr/WbCWG0DMoLv/4F4d/gP45vQtpmDO9IE=;
 b=ZXYfc0svV6AdnaA9WGQt06mKv0FU9mbW3JSC3XgXtcPKr3cjTNvHgRAzj9VKFkTt1p
 MEVzss9rv0xtQ16oZHrjhsZWHKMoYSC5o5r+S+B3wek8JK+gzS9y1x+6OnXRHvRDHWoL
 1tKjYKbtFvIQ3T8Em/YETeMK/T3Y0NfmbuUsQ0vNgs+/BMItxcf3MeZ7kCJ/uiWp+6km
 DrIchD7MHtqgc3Ybe89Rnrc+34tFA7QVX57fMqgyxsqRthVRR2a6zxn+lYRSEuGh6zb/
 b+zZFvOGvzFVi9DorulZSHZqIxiViXStPNITT6DfaEEr1UOxm4sDLL8eH4Qd9bcq+sDY
 msKQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
 :date:message-id:subject:to:cc;
 bh=eYT/mLbIULr/WbCWG0DMoLv/4F4d/gP45vQtpmDO9IE=;
 b=U7XhLn231YEB+29BB6lLn1ru5r+zq2ovUg30f8hlW9mAykgoVwP5EbgH6wFzwa6Wta
 3V8NuG09/KwH5FffAQ3bEhgN5HnfNvqJ7Ljk3CVWIsAID+hbf0gsFAoMmM2EO5Zminr5
 ynconGSKzrMs0Xxn2q9wfQnuqmBjZaRayOr8r0H7cG2yeWshOWyD8XLhLGeW+/7J4nch
 DRmpqQ9dhxX/krgDr0WgSiTy4d4vz/gazIhpDKIqT1KVrofz4+/NNLlu8PFcUCs7aZ9C
 qJPrWt499HfGfewzQ0ZNVUlCq3bs+DDiMMNSZWb63zqBndQlqrLVRb8NhaLtBQhWh4a/
 QvWQ==
X-Gm-Message-State: AN3rC/6mYYX2souDG6MssNZWpZLj6ozi+jvukVYIDfkwTQ5WdXDodA3r
 F4N5UxMyv4ojdULUI7NpModwpDN3qg==
X-Received: by 10.157.48.120 with SMTP id w53mr10632243otd.55.1492986485441;
 Sun, 23 Apr 2017 15:28:05 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.157.9.178 with HTTP; Sun, 23 Apr 2017 15:28:04 -0700 (PDT)
In-Reply-To: <cf9e7b8e-44c1-43fd-7c49-f31249ea90a5@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
 <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
 <30d8b181-d869-de24-9c86-cc1dc6ec461b@HIDDEN>
 <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@HIDDEN>
 <01922284-4265-6510-feee-dcc7301787ad@HIDDEN>
 <cf9e7b8e-44c1-43fd-7c49-f31249ea90a5@HIDDEN>
From: Noam Postavsky <npostavs@HIDDEN>
Date: Sun, 23 Apr 2017 18:28:04 -0400
X-Google-Sender-Auth: jkkCn7X3ISGfcB-tkVz6xzTeS0M
Message-ID: <CAM-tV-9ApU6RemdAfrb7AAVhVzYk=k9EntKT=6-wSfCnWo-O8A@HIDDEN>
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Jonathan Ganc <jonganc@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 26066
Cc: 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

> Subject: [PATCH] update vc-git
>
> ---

Could you add a meaningful commit message please?  See CONTRIBUTE (under
"Commit messages") for details of Emacs' standard format.

I think the patch is basically okay now, just a few minor nitpicks below.

> +(defun vc-git--git-status-to-vc-state (code-list)
> +  "Convert a list CODE-LIST of two-letter git status strings to a vc status.

This line is too long, I think it should be fine to shorten to just
"Convert CODE-LIST to a vc status".  You explain the format of
CODE-LIST in the next paragraph anyway.

> +Each element of CODE-LIST comes from the first two characters of
> +a line returned by 'git status' and should be passed in the order given by 'git status'.

This paragraph looks unfilled, hit M-q on it.

> +       ;; I have only seen this with a file that is only present in the
> +       ;; index.  Let us call this `removed'

Missing period.

> +      (setq code-list
> +            (mapcar (lambda (s)
> +                      (substring s 0 2))
> +                    (delete "" (split-string status "\0"))))

If you pass a non-nil OMIT-NULLS parameter to split-string, the
(delete ""...) should become unnecessary.

> +      (vc-git--git-status-to-vc-state code-list))))

I would suggest dropping the temporary code-list variable here, and
just do

      (vc-git--git-status-to-vc-state
       (mapcar (lambda (s) (substring s 0 2))
               (split-string status "\0" t)))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 23 Apr 2017 18:22:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 23 14:22:09 2017
Received: from localhost ([127.0.0.1]:36734 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1d2M9A-0001ne-Uf
	for submit <at> debbugs.gnu.org; Sun, 23 Apr 2017 14:22:09 -0400
Received: from mail-qk0-f194.google.com ([209.85.220.194]:33985)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1d2M98-0001mt-Lm
 for 26066 <at> debbugs.gnu.org; Sun, 23 Apr 2017 14:22:06 -0400
Received: by mail-qk0-f194.google.com with SMTP id u75so1117966qka.1
 for <26066 <at> debbugs.gnu.org>; Sun, 23 Apr 2017 11:22:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding;
 bh=zej7l5f1ikYCp/pHBDJPvlka5Qqp31ydb8MF5y7gcV8=;
 b=PCMJIzfcKnOEM1SywyBZ4uMgJnDbLF5pNYG7OB1UsJPS5pGSqNQsWdn5axqkXFnL4M
 rj1MZ11XutgyZMEvr67C/5CoGa75UgoiArR7PYMq0RBsrOQbSQbf4hxsGcJdPOUCnXAN
 oj9+m7pavQch1fS1Of8K6WzwzS9Yk2KtzGOxv+360rM2veVDKqyek44SdkK95zMEL19p
 R35sZAObAuumwYEUtoUA5TstESQHwILv2wkIfU/YxERdNZvdVuFqD1HaLKPAO3rWuWTE
 9FxWLJrL2Ic/0fhmSYv+BMmrzreo73XG0Hr14nt8H7ysR4kaRW/mvvCypwzaLV6RSocg
 MCJw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=zej7l5f1ikYCp/pHBDJPvlka5Qqp31ydb8MF5y7gcV8=;
 b=qtCNr288UM2hUWFaEOsJVvMDnLLtri+4/deR8n9Ecap46oGC58v/o3jnv9UxRfli+/
 /cRBmjIP9dCmBNWP+NuHiyw5Cak5R9FpdfixJKywxEK1C4E8zWrLEeSh+MTsFsvwO0Ko
 ohJNPfNSajhO9YPjGYLiGoA8tUmkB7QtisoLqsMtwtgDKzpae4aG6WdNj4vdt7Ahe2RY
 6u864icPr6FOMGcTUp7bCh1Mm4pxHuX8ELcVJHUxXICjh15N0GQctrdPq4ODFc8YXxOP
 I1ngHd+cG3R8oit29ON5TeaLrfPHNheI7U0m5MOhhInxTqO8VJXn6yVy5YsGyDsEqZEl
 0KeQ==
X-Gm-Message-State: AN3rC/5AyHBKWGzY9aS15FtZpNkHUaA7vv6no7EHgqnMe6jKQENHsx5W
 3wllhy+hY7lNyQ==
X-Received: by 10.55.65.65 with SMTP id o62mr24209388qka.52.1492971721129;
 Sun, 23 Apr 2017 11:22:01 -0700 (PDT)
Received: from [10.148.5.39] (c-65-96-175-120.hsd1.ma.comcast.net.
 [65.96.175.120])
 by smtp.gmail.com with ESMTPSA id l10sm7383164qte.15.2017.04.23.11.21.59
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 23 Apr 2017 11:22:00 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
 <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
 <30d8b181-d869-de24-9c86-cc1dc6ec461b@HIDDEN>
 <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@HIDDEN>
 <01922284-4265-6510-feee-dcc7301787ad@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <cf9e7b8e-44c1-43fd-7c49-f31249ea90a5@HIDDEN>
Date: Sun, 23 Apr 2017 14:21:59 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <01922284-4265-6510-feee-dcc7301787ad@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

Since there have been no more objections to my patch (the one in my 
previous note does not bind default-directory), could someone merge it in?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 14 Apr 2017 00:42:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 13 20:42:52 2017
Received: from localhost ([127.0.0.1]:46273 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cypK8-0004R7-2K
	for submit <at> debbugs.gnu.org; Thu, 13 Apr 2017 20:42:52 -0400
Received: from mail-qk0-f193.google.com ([209.85.220.193]:36195)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cypK6-0004Qq-9a
 for 26066 <at> debbugs.gnu.org; Thu, 13 Apr 2017 20:42:50 -0400
Received: by mail-qk0-f193.google.com with SMTP id v75so10463120qkb.3
 for <26066 <at> debbugs.gnu.org>; Thu, 13 Apr 2017 17:42:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to; bh=gArGKLOFfqUpVCwe/RATs00xg363sv5DrJ4x3LzXW6Q=;
 b=Jqq0HjHvRrvM4Jnl1X+6Yj2Uue7BGX8TExbsl5xAqv/piPhV9zx3lzPIhshwYfW0mX
 nFopQmlHq0CH3FT5gYQmqKEnoDiz6lrkn0vZMo5coXsMVI7NMLQ51AenvHB1aQP9sylo
 MUsksJ5aKbPQamur6xGYwFlIPT2r7gQLXUBgpk5Q9cddXCz3nE5AxZIGN64TCDVpfQyw
 SKArmkKMLk51enoYdnbY+zVtZppF+rJ0lnDuoKui1nmIKiruUgONnpAZMPLT9nZOT1Au
 CG4O223IlP+OvRDXKrDo6XWpN9EBXcZdhw4HxrGT0xiS5mhZZ4RrWWtzjuSmoLnmXWpZ
 aEaA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to;
 bh=gArGKLOFfqUpVCwe/RATs00xg363sv5DrJ4x3LzXW6Q=;
 b=Xlvxczi1WKn4wZWF/ky/GJCk73pmzrmn+7r1xM9PR0LXU6gkq2VdxNHxLvwqNIFZQW
 LfN9GjhBiJUfIo4wOEVqHqv8BKS/BX2Nz5CiCOoQBDbwCiiGDHl/OMpAg15EJ4qnBxCt
 JNV1jO0sDDl8DpYrz2bVBM/snoSCgHHzNOEcP1elYDy8N9y9Yzbvk6AWLxho9pn6Vbkq
 CkknZCF3vCsNQhf09INiPPz5p5vcgLM9+61BEkNynvQ5hUOf52WrakMvMYMKcxPgDR8Y
 4OPfuKsy8Q3OcJVt77rXbl3t7KZsPsaPZYqkTcsx4YuuEIgzdZHQCgShpBv59SSMO8Gy
 ZNJQ==
X-Gm-Message-State: AN3rC/7q2rSuB7QcsEOuGCvuyvJNVSVkZ/ZSwa5oHZG6mz4W4Y+EDKyA
 QG9VZ4EM7NxPBQ==
X-Received: by 10.55.15.72 with SMTP id z69mr4643370qkg.69.1492130564624;
 Thu, 13 Apr 2017 17:42:44 -0700 (PDT)
Received: from [192.168.1.200] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id z42sm272893qtb.26.2017.04.13.17.42.43
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 13 Apr 2017 17:42:43 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
 <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
 <30d8b181-d869-de24-9c86-cc1dc6ec461b@HIDDEN>
 <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <01922284-4265-6510-feee-dcc7301787ad@HIDDEN>
Date: Thu, 13 Apr 2017 20:42:42 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@HIDDEN>
Content-Type: multipart/mixed; boundary="------------F4169BC3BC0C2094615A5BDE"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

This is a multi-part message in MIME format.
--------------F4169BC3BC0C2094615A5BDE
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

First, I'm sorry for this delayed response. I've had a busy few days 
(and I needed to think about the issue)!

I'm fine with decoupling the question about default-directory from the 
patch for git status. I have attached a patch that does not bind 
default-directory. (And I now have turned in the assignment paperwork to 
the FSF!).

I continue to think that binding default-directory in vc-git-state makes 
the most sense.

> If vc-git supports calling vc-git-state from outside of the 
> repository, but not some other commands, or if vc-git-state does but 
> some other backends' vc-xx-state does not, this will increase 
> inconsistency and make it harder for the programmers to write 
> VCS-agnostic code, which is one of the main goals of VC.

But being vcs-agnostic is more for people who use vc-state or 
vc-state-refresh, rather than people actually writing the vc-specific 
functions, no? If this bug is unchanged, people using vc-state have to 
ask themselves: "if the backend is git, I have to bind default-directory 
but if it's not, I don't." That is inconsistent with vc agnosticism.

> Is it necessary for correct output in other backends, in similar 
> scenarios?
>
> I agree that fixing this makes sense, but it should be done in an 
> organized fashion

That's a valid question and a valid point. But I actually think that 
adding the binding in vc-git-state furthers the goal of systematically 
answering them. I doubt we'll be able to find, at one time, people with 
knowledge of more than 4 or 5 of the vc's (e.g. I know only git) who 
have the time to address this issue. What we can do instead, though, is 
to encourage people to properly write the backend specific functions. 
If, at some point, we notice that every vc-BACKEND-state binds 
default-directory, then we can move the binding to vc-state.

However, this question reinforces my opinion that binding 
default-directory can be treated satisfactorily as a backend-specific 
question. The fact that I can't argue in general that an arbitrary vc 
system needs default-directory set suggests to me that one should leave 
it to the vc system to decide. For example, I could imagine a backend 
that wants the current directory to be the root directory of the 
repository, rather than the directory containing the file.

--------------F4169BC3BC0C2094615A5BDE
Content-Type: text/x-patch;
 name="0001-update-vc-git.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-update-vc-git.patch"

From cc492722e9ae974e568a2bf79121dfd8664a766e Mon Sep 17 00:00:00 2001
From: Jonathan Ganc <jonganc@HIDDEN>
Date: Mon, 10 Apr 2017 00:38:52 -0400
Subject: [PATCH] update vc-git

---
 lisp/vc/vc-git.el | 78 ++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 52 insertions(+), 26 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 1a3f1bf..213bdaa 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -231,34 +231,60 @@ (defun vc-git--state-code (code)
     (?U 'edited)     ;; FIXME
     (?T 'edited)))   ;; FIXME
 
+(defun vc-git--git-status-to-vc-state (code-list)
+  "Convert a list CODE-LIST of two-letter git status strings to a vc status.
+
+Each element of CODE-LIST comes from the first two characters of
+a line returned by 'git status' and should be passed in the order given by 'git status'.
+
+\(It is necessary to allow CODE-LIST to be a list because
+sometimes git status returns multiple lines, e.g. for a file that
+is removed from the index but is present in the HEAD and working
+tree.) "
+  (pcase code-list
+    ('nil 'up-to-date)
+    (`(,code)
+     (pcase code
+       ("!!" 'ignored)
+       ("??" 'unregistered)
+       ;; I have only seen this with a file that is only present in the
+       ;; index.  Let us call this `removed'
+       ("AD" 'removed)
+       (_ (cond
+           ((string-match-p "^[ RD]+$" code) 'removed)
+           ((string-match-p "^[ M]+$" code) 'edited)
+           ((string-match-p "^[ A]+$" code) 'added)
+           ((string-match-p "^[ U]+$" code) 'conflict)
+           (t 'edited)))))
+    ;;  I know of two times when git state returns more than one element,
+    ;;  in both cases returning '("D " "??")':
+    ;;  1. when a file is removed from the index but present in the
+    ;;     HEAD and working tree
+    ;;  2. when a file A is renamed to B in the index and then back to A
+    ;;     in the working tree
+    ;;  In both these instances, `unregistered' is a reasonable response.
+    (`("D " "??") 'unregistered)
+    ;;  In other cases, let us return `edited'.
+    (_ 'edited)))
+
 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
-  ;; FIXME: This can't set 'ignored or 'conflict yet
-  ;; The 'ignored state could be detected with `git ls-files -i -o
-  ;; --exclude-standard` It also can't set 'needs-update or
-  ;; 'needs-merge. The rough equivalent would be that upstream branch
-  ;; for current branch is in fast-forward state i.e. current branch
-  ;; is direct ancestor of corresponding upstream branch, and the file
-  ;; was modified upstream.  But we can't check that without a network
-  ;; operation.
-  ;; This assumes that status is known to be not `unregistered' because
-  ;; we've been successfully dispatched here from `vc-state', that
-  ;; means `vc-git-registered' returned t earlier once.  Bug#11757
-  (let ((diff (vc-git--run-command-string
-               file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))
-    (if (and diff
-             (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0\\(.*\n.\\)?"
-                           diff))
-        (let ((diff-letter (match-string 1 diff)))
-          (if (not (match-beginning 2))
-              ;; Empty diff: file contents is the same as the HEAD
-              ;; revision, but timestamps are different (eg, file
-              ;; was "touch"ed).  Update timestamp in index:
-              (prog1 'up-to-date
-                (vc-git--call nil "add" "--refresh" "--"
-                              (file-relative-name file)))
-            (vc-git--state-code diff-letter)))
-      (if (vc-git--empty-db-p) 'added 'up-to-date))))
+  (let ((status
+         (vc-git--run-command-string file "status" "--porcelain" "-z"
+                                     "--untracked-files" "--ignored" "--"))
+        code-list)
+    (if (null status)
+        ;; If status is nil, there was an error running git, likely because
+        ;; the file is not in a git repo.
+        'unregistered
+      ;; If this code is adapted to parse 'git status' for a directory,
+      ;; note that a renamed file takes up two null values and needs to be
+      ;; treated slightly more carefully.
+      (setq code-list
+            (mapcar (lambda (s)
+                      (substring s 0 2))
+                    (delete "" (split-string status "\0"))))
+      (vc-git--git-status-to-vc-state code-list))))
 
 (defun vc-git-working-revision (_file)
   "Git-specific version of `vc-working-revision'."
-- 
2.9.3


--------------F4169BC3BC0C2094615A5BDE--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 11 Apr 2017 23:36:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 11 19:36:29 2017
Received: from localhost ([127.0.0.1]:43448 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cy5Kn-0000tZ-Ju
	for submit <at> debbugs.gnu.org; Tue, 11 Apr 2017 19:36:29 -0400
Received: from mail-wm0-f49.google.com ([74.125.82.49]:36738)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1cy5Kl-0000tK-Mt
 for 26066 <at> debbugs.gnu.org; Tue, 11 Apr 2017 19:36:27 -0400
Received: by mail-wm0-f49.google.com with SMTP id o81so74892978wmb.1
 for <26066 <at> debbugs.gnu.org>; Tue, 11 Apr 2017 16:36:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:from:to:references:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=j9+wvAbJzW1ZRaK3YcDL9XA8pl+mxCYCMfd7JTF8Df8=;
 b=QjCuEYsgeqJFSQfOJdq2F8FyzcxdYm6GB0qjGycATIqqKgv62mAE/qIllHZBZa7dko
 lwY6PFQlNSSmwVm/KTXZ/mTtk8f3jPzW0uw1LTuIf/qQHZ4yMN3+r/0HkCUjklJRXZN2
 red+fnMTsnLt57WGso7TiPfMKxhLKLMcieYl9VTkolAthFREn9PBL3q1sSyDRDiBmtKO
 GeJHlpQ9TeHU5JJ8ZTjjIPCbvEUt4Tb4T68eQU9/Y6I7gQmPix3o+Q3tSgzpHQv+ZWy8
 miSRMM7G+QM/Js4czU+A8qmvXNoQBoAWbuYwi5euTpRm3DIMSIcXcP+ttfupZzJqdZQ3
 GzRg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:from:to:references:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=j9+wvAbJzW1ZRaK3YcDL9XA8pl+mxCYCMfd7JTF8Df8=;
 b=MyUslLmA6sDtumvAsx6TKft1vaR2rmKD1BbFqNxszIYOA0Eak0+WoJolA8DTby4eT6
 6OIekh8RaIyjOnaqi018T51V2HUHedp9k+4LAYZqger1bRDxahrKQn0kTXfpJiybqjeP
 u/jOECkUazEWliXgg2IJLnerR8KJ16julh5ubXRsgOqNwsKNw9G91kfaPf+ug751bzt4
 w8GZFCax9Al4xc+gTugaUC1w13I2fUjv4fENTBfBVcj7rvepjeQh6kF7wKWDqLfqYK5h
 ZV8Tfo0U3Vb17TLacSQIFI3tIapAn3fggfJvsOuCjxLRlRIbegcfc2W2G845Wks6ao7r
 WYyQ==
X-Gm-Message-State: AN3rC/7Ho0yibQFINaivKs+3TyaICVeHqhZHrt6Gs1m6zeWrOAyKe3iJw8atI4kAm7uNYw==
X-Received: by 10.28.184.73 with SMTP id i70mr139218wmf.104.1491953782092;
 Tue, 11 Apr 2017 16:36:22 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.173.156])
 by smtp.googlemail.com with ESMTPSA id 92sm23451631wrh.8.2017.04.11.16.36.20
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 11 Apr 2017 16:36:21 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
From: Dmitry Gutov <dgutov@HIDDEN>
To: Jonathan Ganc <jonganc@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
 <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
 <30d8b181-d869-de24-9c86-cc1dc6ec461b@HIDDEN>
 <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@HIDDEN>
Message-ID: <7ba3bbb3-389a-ccf0-a9d1-baf25489c8af@HIDDEN>
Date: Wed, 12 Apr 2017 02:36:19 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.0
MIME-Version: 1.0
In-Reply-To: <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

On 12.04.2017 02:27, Dmitry Gutov wrote:

>> (which, surprisingly, is
>>> slighly faster than (file-name-directory (concat default-directory 
>>> file)) ).
> 
> That probably depends on the file. The first option was faster in the 
> example I've tried.

I meant the second one, sorry.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 11 Apr 2017 23:27:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 11 19:27:51 2017
Received: from localhost ([127.0.0.1]:43443 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cy5CR-0000g8-O7
	for submit <at> debbugs.gnu.org; Tue, 11 Apr 2017 19:27:51 -0400
Received: from mail-wm0-f65.google.com ([74.125.82.65]:34408)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1cy5CP-0000ft-Nz
 for 26066 <at> debbugs.gnu.org; Tue, 11 Apr 2017 19:27:50 -0400
Received: by mail-wm0-f65.google.com with SMTP id x75so3214668wma.1
 for <26066 <at> debbugs.gnu.org>; Tue, 11 Apr 2017 16:27:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=tAMvQLwcx5HSSnGPB4F3Fni9ftNCGaXX7GsYOTFUJAU=;
 b=EwzLrCSLfqJORcuuH6ZVxwYfN8lHB05OuklQlgQAoo00FzyzUC+FozVss5HHQ6KW8S
 m0OkN/Er99etgF08FLOgzuEsPm+/FBrBWZvPN4veaqCIZHb1C0pBncR9I2xWrOgXa/mo
 JEtyxruG4lgr1v6Az1jJ/N9zWuDu9Q21VeazetLUFl7T8bWc+V6YUPRJzYk1XHbquWyb
 77XCYXs3HJ1sSjRqBFUtgqv2yCtOGW02e6labeNnFdjBuhNXmjDBgbDAWMgVa6+IdapG
 me55qAHU16jRFEtX1/ZgQXUK7AcBhCH/7YjauC+dBJvII5ElhpW3ahngkCIilWAtu0V9
 0e6w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=tAMvQLwcx5HSSnGPB4F3Fni9ftNCGaXX7GsYOTFUJAU=;
 b=ezx92R4jXApBZ6O55LDmMsIl4gyqpAx7ABrhflPa3N0lNKKCTLm79na8XlbfofDogB
 Or5xrtQwkxBf1WCAocbeR2eWao2PoxmRKyRjCkhrU3W5lB9y0sfc47muacXwJKNOzcEJ
 N+muO6UfNwqhC2pFmJsSxNv+lj6TH0OCC2EFV84ZvLwul38B+jp7Kb/bzOHl1YGbEY7+
 F89ep9mappzzzRp+bbVLjM4ETOT4pittkhpRTljxf3cnRj7Jt5c3mz5Q52++nObbuvWh
 Nhj7I94UNiWYB4MBwvFmx6itmrq5uWCEgE8RewVceTiOQNkv6uAQDZpqjwlPH7c7ZauE
 S3KA==
X-Gm-Message-State: AN3rC/4snvFcDdFXUYFaZ9v6ijBpqB6WXVDMTxhzO5bh2iXeWxV1ZDKg
 CT+v6xcOZly15Q==
X-Received: by 10.28.143.71 with SMTP id r68mr17826807wmd.61.1491953263887;
 Tue, 11 Apr 2017 16:27:43 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.173.156])
 by smtp.googlemail.com with ESMTPSA id 204sm4298272wmw.0.2017.04.11.16.27.41
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 11 Apr 2017 16:27:42 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Jonathan Ganc <jonganc@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
 <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
 <30d8b181-d869-de24-9c86-cc1dc6ec461b@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@HIDDEN>
Date: Wed, 12 Apr 2017 02:27:41 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.0
MIME-Version: 1.0
In-Reply-To: <30d8b181-d869-de24-9c86-cc1dc6ec461b@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

On 11.04.2017 16:08, Jonathan Ganc wrote:
> I think I've changed my mind about where/whether to bind 
> default-directory. Since it is not universally bound by all vcs engines, 

That doesn't necessarily imply that they shouldn't.

> On the other hand, since it sometimes is 
> necessary for correct output, I do think it should be bound in 
> vc-git-state.

Is it necessary for correct output in other backends, in similar scenarios?

I agree that fixing this makes sense, but it should be done in an 
organized fashion, and separately from this patch.

If vc-git supports calling vc-git-state from outside of the repository, 
but not some other commands, or if vc-git-state does but some other 
backends' vc-xx-state does not, this will increase inconsistency and 
make it harder for the programmers to write VCS-agnostic code, which is 
one of the main goals of VC.

vc-state is also among the first functions a piece of third-party code 
would call. So it becomes the choke point which forces the caller to get 
the value of default-directory right, before any other backend commands 
are called. Until we take inventory of them, it's better to keep the bug 
in vc-state, I think.

>> Since, in principle, the vc functions should be agnostic to the choice 
>> of vcs, either a) vc-state documentation should state that 
>> default-directory should be set to get generally correct responses or

If we decide that, that should be the rule we declare for all VC backend 
commands, not just vc-state.

>> b) it should be set in some function (and I agree that 
>> vc-state-refresh makes sense).
>>
>> I think the overhead of setting the directory is rather low. In some 
>> admittedly rudimentary benchmarks, there is almost no difference in 
>> performance setting default-directory.

Yeah, I'm not worried about performance here either.

>> There's also the question of how to handle default-directory. You 
>> cannot simply do (file-name-directory file), because that fails if 
>> FILE is given without a directory. I think the correct one is 
>> (file-name-directory (expand-file-name file))

Yup, that should work. I'm not sure any of these commands are ever 
called with relative names, though.

> (which, surprisingly, is 
>> slighly faster than (file-name-directory (concat default-directory 
>> file)) ).

That probably depends on the file. The first option was faster in the 
example I've tried.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 11 Apr 2017 13:08:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 11 09:08:44 2017
Received: from localhost ([127.0.0.1]:42056 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxvXI-0007EQ-97
	for submit <at> debbugs.gnu.org; Tue, 11 Apr 2017 09:08:44 -0400
Received: from mail-qk0-f195.google.com ([209.85.220.195]:36153)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cxvXG-0007ED-Av
 for 26066 <at> debbugs.gnu.org; Tue, 11 Apr 2017 09:08:42 -0400
Received: by mail-qk0-f195.google.com with SMTP id v75so24001965qkb.3
 for <26066 <at> debbugs.gnu.org>; Tue, 11 Apr 2017 06:08:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding;
 bh=cuO/fWJYW+H6zgr/n0lPOgNTmQMCSPCE6y3ApEtX5v0=;
 b=qnKmbpNep+r+dW7Y/pZolY5yhKquRcerzCXEqltQyx6bPPKCAgCX+88uYrAWfRfncH
 nUcaz8V2/+xk97KFzb9MTNsLVzGQakczLHwPgcGefW1AVdjIKXCqwOKRfJL0tIOPrY1Y
 lm9OsRcYhR4xDS+0cvXzkcN4R2yYBob7l3MXFKc9TVG1/ZfKqI/SYJSBm7YOUw0tBwpt
 eG18XGMP55kmcL7J512hh9W6dPaAJwjHbUVWb5pEZ2agPt1TjZHw1HczynXrHo0AfwLV
 RLGV5tLIn7odF4zUlGMY5IwEjBKXTBOnxI/7192dIW77vVM90GMaL3jjbEso2fmX26cA
 ScsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=cuO/fWJYW+H6zgr/n0lPOgNTmQMCSPCE6y3ApEtX5v0=;
 b=HXkLi+Wt7uPSdlaky3kKrKP4cZzJgwClgD1n92FUv/alU2URdybIUxLGfriS0ajkjN
 NFP8aipOI7pM0p8gpXlMG+Bc7L9g41ZYSb5cNE08dg5AAU05nRSa0NFSZlxY5e/ZishN
 ktBg85Yv9IjFk3mwwna33xXdGvdsFXZ/IBorfEwOaD+f1bhKtr9cloAdFQY9xaaKJww/
 rMvnMT5xq3gqftMTEBDILkyXCHiJ+uiOeEr/iZzfUWUPBJ4qrzTVxyrYgkcxUfFIZxXx
 7rIzE2uRB4BBUpoOFuBdCco0QQPKUDsVUNnNgtO6VJXAzuO95VzceXLYP4XEVOHXtvMc
 AUkw==
X-Gm-Message-State: AN3rC/6Xw5wEOd8cH3QQvS0v3CLRcM9mw/aSaU0j7E3ytreBgwG//EJlSj5jWpsoUsNe5g==
X-Received: by 10.55.210.1 with SMTP id f1mr16718107qkj.165.1491916116857;
 Tue, 11 Apr 2017 06:08:36 -0700 (PDT)
Received: from [192.168.1.198] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id s28sm10971877qts.65.2017.04.11.06.08.35
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 11 Apr 2017 06:08:36 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
 <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <30d8b181-d869-de24-9c86-cc1dc6ec461b@HIDDEN>
Date: Tue, 11 Apr 2017 09:08:35 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

I think I've changed my mind about where/whether to bind 
default-directory. Since it is not universally bound by all vcs engines, 
it should probably be considered "backend specific", which would 
therefore suggest that it not be bound before the backend specific 
functions, e.g. vc-git-state. On the other hand, since it sometimes is 
necessary for correct output, I do think it should be bound in vc-git-state.


On 04/10/2017 11:52 PM, Jonathan Ganc wrote:
>
> The binding affects the output if default-directory is not set inside 
> the file's repository.
>
> Since, in principle, the vc functions should be agnostic to the choice 
> of vcs, either a) vc-state documentation should state that 
> default-directory should be set to get generally correct responses or 
> b) it should be set in some function (and I agree that 
> vc-state-refresh makes sense).
>
> I think the overhead of setting the directory is rather low. In some 
> admittedly rudimentary benchmarks, there is almost no difference in 
> performance setting default-directory.
>
> There's also the question of how to handle default-directory. You 
> cannot simply do (file-name-directory file), because that fails if 
> FILE is given without a directory. I think the correct one is 
> (file-name-directory (expand-file-name file)) (which, surprisingly, is 
> slighly faster than (file-name-directory (concat default-directory 
> file)) ).





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 11 Apr 2017 03:52:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 10 23:52:33 2017
Received: from localhost ([127.0.0.1]:41826 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxmr2-0006Qw-Mm
	for submit <at> debbugs.gnu.org; Mon, 10 Apr 2017 23:52:32 -0400
Received: from mail-qt0-f194.google.com ([209.85.216.194]:34574)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cxmr1-0006Qk-Ih
 for 26066 <at> debbugs.gnu.org; Mon, 10 Apr 2017 23:52:31 -0400
Received: by mail-qt0-f194.google.com with SMTP id r49so8864826qta.1
 for <26066 <at> debbugs.gnu.org>; Mon, 10 Apr 2017 20:52:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to; bh=AwE0AV+Yw6DG9ShIPjrC+51aeURUDYcHGi1kv7eWYy8=;
 b=FQyFc3L0cabW6BRmWN5caBsIFOS7q/wfKGf1suTMqfhHNmuwt4qDe5NJH8GwzPk5rf
 zWQYE+2Vin03Kw4gnxLCWl6AK6bS/q4FmY5/06bRCasNueMrCsoGOPcDXzI2GuYBwt0P
 rgpA1CWIxA6RllRpA/tieFQS4ExsOjoBnHTkSyHmmbNJetXq7DTF4iObuxJWfA1chsJL
 mq4BcQ6NLkEwoG7/vud7YMDgMeDecQX7/oHbW2bhSD3RVEJjVCfBMZyqUqS0DRqlbkKM
 ih69gTUvK7de8mroWk2zWER/eoPJgoXlp27GNYMmKPejNHW02g+gIgdWvXzObjrzsmdc
 RffQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to;
 bh=AwE0AV+Yw6DG9ShIPjrC+51aeURUDYcHGi1kv7eWYy8=;
 b=bFKU7K+2/qK3Q7EVLfH9AJu9C3VoMlGEPQLYWxvOvhcbOPp6lZo4M76EEygAP8TIoQ
 A/3DP5JCMap2lNlZqEq/95g3cKEojOxauPCiK43XssHTI8hvu+/W9SH95B0wGt/l6ISa
 5W7irFXKlnQ4a7QuR+Ahm13/XX10rQum6+I1nwcVOTAsv2vahoHnTDccLDIdeGGVWLCL
 31kxGf3uUthauuq44+knUNU6FffbozgM/HZDcN661ccxtkd4Mb35qizToBhuyu5NWYBC
 oNLb3d/lBDgvaf0PbVMaZDNgMy6apxEfSvF2z3u2HbVcWWG4m5HavaVEfMYXgUxKsAX+
 Md4w==
X-Gm-Message-State: AN3rC/5bqLJGAkzJRGwFykHkNYL3GZY3CygKXJKcAW6A9TjMUzwL7FqgtEyAZTsTJE/Ydw==
X-Received: by 10.237.44.99 with SMTP id f90mr6158925qtd.24.1491882745938;
 Mon, 10 Apr 2017 20:52:25 -0700 (PDT)
Received: from [192.168.1.198] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id 1sm5132602qtm.59.2017.04.10.20.52.24
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 10 Apr 2017 20:52:25 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <1a23269d-1ead-1771-1afd-e2c9c5840cb4@HIDDEN>
Date: Mon, 10 Apr 2017 23:52:24 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
Content-Type: multipart/mixed; boundary="------------1D6459AC6D25AF909738FB0B"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

This is a multi-part message in MIME format.
--------------1D6459AC6D25AF909738FB0B
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

I've incorporated Thien-Thi's suggestion, as well as an if to check 
status for nil (which indicates unregistered).


On 04/10/2017 08:07 PM, Dmitry Gutov wrote:
> You are right. But we could set it in vc-state-refresh.
>

On 04/10/2017 07:46 PM, Dmitry Gutov wrote:
>
> Thanks. I guess the main thing left is to decide whether vc-git-state 
> should bind default-directory. For example, vc-bzr-state doesn't, 
> while vc-hg-state does.
>
> Does this binding affect the command output, in this particular case?

The binding affects the output if default-directory is not set inside 
the file's repository.

Since, in principle, the vc functions should be agnostic to the choice 
of vcs, either a) vc-state documentation should state that 
default-directory should be set to get generally correct responses or b) 
it should be set in some function (and I agree that vc-state-refresh 
makes sense).

I think the overhead of setting the directory is rather low. In some 
admittedly rudimentary benchmarks, there is almost no difference in 
performance setting default-directory.

There's also the question of how to handle default-directory. You cannot 
simply do (file-name-directory file), because that fails if FILE is 
given without a directory. I think the correct one is 
(file-name-directory (expand-file-name file)) (which, surprisingly, is 
slighly faster than (file-name-directory (concat default-directory file)) ).

--------------1D6459AC6D25AF909738FB0B
Content-Type: text/x-patch;
 name="0001-update-vc-git.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-update-vc-git.patch"

From 8892f98fc0a8a956bc1adefcc0394ac6cf5e47d3 Mon Sep 17 00:00:00 2001
From: Jonathan Ganc <jonganc@HIDDEN>
Date: Mon, 10 Apr 2017 00:38:52 -0400
Subject: [PATCH] update vc-git

---
 lisp/vc/vc-git.el | 79 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 53 insertions(+), 26 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 1a3f1bf..7c16125 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -231,34 +231,61 @@ (defun vc-git--state-code (code)
     (?U 'edited)     ;; FIXME
     (?T 'edited)))   ;; FIXME
 
+(defun vc-git--git-status-to-vc-state (code-list)
+  "Convert a list CODE-LIST of two-letter git status strings to a vc status.
+
+Each element of CODE-LIST comes from the first two characters of
+a line returned by 'git status' and should be passed in the order given by 'git status'.
+
+\(It is necessary to allow CODE-LIST to be a list because
+sometimes git status returns multiple lines, e.g. for a file that
+is removed from the index but is present in the HEAD and working
+tree.) "
+  (pcase code-list
+    ('nil 'up-to-date)
+    (`(,code)
+     (pcase code
+       ("!!" 'ignored)
+       ("??" 'unregistered)
+       ;; I have only seen this with a file that is only present in the
+       ;; index.  Let us call this `removed'
+       ("AD" 'removed)
+       (_ (cond
+           ((string-match-p "^[ RD]+$" code) 'removed)
+           ((string-match-p "^[ M]+$" code) 'edited)
+           ((string-match-p "^[ A]+$" code) 'added)
+           ((string-match-p "^[ U]+$" code) 'conflict)
+           (t 'edited)))))
+    ;;  I know of two times when git state returns more than one element,
+    ;;  in both cases returning '("D " "??")':
+    ;;  1. when a file is removed from the index but present in the
+    ;;     HEAD and working tree
+    ;;  2. when a file A is renamed to B in the index and then back to A
+    ;;     in the working tree
+    ;;  In both these instances, `unregistered' is a reasonable response.
+    (`("D " "??") 'unregistered)
+    ;;  In other cases, let us return `edited'.
+    (_ 'edited)))
+
 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
-  ;; FIXME: This can't set 'ignored or 'conflict yet
-  ;; The 'ignored state could be detected with `git ls-files -i -o
-  ;; --exclude-standard` It also can't set 'needs-update or
-  ;; 'needs-merge. The rough equivalent would be that upstream branch
-  ;; for current branch is in fast-forward state i.e. current branch
-  ;; is direct ancestor of corresponding upstream branch, and the file
-  ;; was modified upstream.  But we can't check that without a network
-  ;; operation.
-  ;; This assumes that status is known to be not `unregistered' because
-  ;; we've been successfully dispatched here from `vc-state', that
-  ;; means `vc-git-registered' returned t earlier once.  Bug#11757
-  (let ((diff (vc-git--run-command-string
-               file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))
-    (if (and diff
-             (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0\\(.*\n.\\)?"
-                           diff))
-        (let ((diff-letter (match-string 1 diff)))
-          (if (not (match-beginning 2))
-              ;; Empty diff: file contents is the same as the HEAD
-              ;; revision, but timestamps are different (eg, file
-              ;; was "touch"ed).  Update timestamp in index:
-              (prog1 'up-to-date
-                (vc-git--call nil "add" "--refresh" "--"
-                              (file-relative-name file)))
-            (vc-git--state-code diff-letter)))
-      (if (vc-git--empty-db-p) 'added 'up-to-date))))
+  (let* ((default-directory (file-name-directory (expand-file-name file)))
+         (status
+          (vc-git--run-command-string file "status" "--porcelain" "-z"
+                                      "--untracked-files" "--ignored" "--"))
+         code-list)
+    (if (null status)
+        ;; If status is nil, there was an error running git, likely because
+        ;; the file is not in a git repo.
+        'unregistered
+      ;; If this code is adapted to parse 'git status' for a directory,
+      ;; note that a renamed file takes up two null values and needs to be
+      ;; treated slightly more carefully.
+      (setq code-list
+            (mapcar (lambda (s)
+                      (substring s 0 2))
+                    (delete "" (split-string status "\0"))))
+      (vc-git--git-status-to-vc-state code-list))))
 
 (defun vc-git-working-revision (_file)
   "Git-specific version of `vc-working-revision'."
-- 
2.9.3


--------------1D6459AC6D25AF909738FB0B--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 11 Apr 2017 00:07:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 10 20:07:31 2017
Received: from localhost ([127.0.0.1]:41722 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxjLH-0007EP-Ir
	for submit <at> debbugs.gnu.org; Mon, 10 Apr 2017 20:07:31 -0400
Received: from mail-wr0-f179.google.com ([209.85.128.179]:33637)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1cxjLF-0007ED-Ov
 for 26066 <at> debbugs.gnu.org; Mon, 10 Apr 2017 20:07:30 -0400
Received: by mail-wr0-f179.google.com with SMTP id l28so29183429wre.0
 for <26066 <at> debbugs.gnu.org>; Mon, 10 Apr 2017 17:07:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=Oku28FYCZff8JN7a2eGSHqOE3AU4WfQ/B3hl1/tobUk=;
 b=GKS4K5rQbZqrTkjzkvhVrMZJeibua1cjTvPI0GoB+QWEc0+UkMlB6RqY0uNo9fO8I9
 2cPPtuQk/ycVG8A/N1DDe66l+CH62eS0GvlhVneDSUAJejobTx0YQhDSdh3RG/uue+3U
 4k+muWKZBTtptcVxk1zGd6DT3cwRpK9I2RzVysbat/jfGQr0rfNQ42d4rJ2iMYqlgqFj
 3EghxWKeYjOf729hhMrbZkwH06t6xXda8c6EmhIXLzgAXTwpZvODGeqWuvMDozYsyYT8
 peIjVxXeq4v/JXX2zAr4vlSkP7sz9gD7QA7cnf9uOI7j3xhyd+R7q/TmH1zi/OotEVSX
 IfBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=Oku28FYCZff8JN7a2eGSHqOE3AU4WfQ/B3hl1/tobUk=;
 b=fd11rcvsRe4l+H/SZrtuUbgpkIfOZPJt0u6EAhQ6ggmYascex8PTY34kOrm+3L4P6O
 jKOy+vqZDyTdo2dV5g+PLAPpWVV1oPGYz2NVnpEdTAhnqycmDedMU2tU6u3WGNHiUdfw
 Yd0qEYZzfWELfPOzCBinucnYo27csanQQ8A+6N94g0OJSssCWU3kZqb4ugzEALU+PIag
 pGsFN/RLfwfEemcoLv5lWMNN6FqEKt2w8b+TNBO35v/QGBPYKnngVWRLDDu6hBkjwVM7
 GKjKTLLiroEejgnmg2rGr5EIPaSVkRrdLVBkEkJxROwC79vxKgIRs9QoesdjxnlMD84b
 9xhg==
X-Gm-Message-State: AN3rC/75j6uG+cyf8rMEO1VhGTn9hwWKiNq171+7CP/88Z0JzQ/dKQGN8z84cgdrqMQY7g==
X-Received: by 10.223.163.17 with SMTP id c17mr7884042wrb.186.1491869244164;
 Mon, 10 Apr 2017 17:07:24 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.173.156])
 by smtp.googlemail.com with ESMTPSA id h68sm211469wmd.19.2017.04.10.17.07.22
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 10 Apr 2017 17:07:23 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Jonathan Ganc <jonganc@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <505388da-e642-8c98-35c0-261d09ff13e1@HIDDEN>
Date: Tue, 11 Apr 2017 03:07:21 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.0
MIME-Version: 1.0
In-Reply-To: <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

On 23.03.2017 04:18, Jonathan Ganc wrote:

> Yeah, I'm not really sure what the workflow should be; I'm just getting 
> started with the vc functions in emacs. One issue, though, is that 
> default-directory can only be set for functions that identify a 
> filename, because we need to have a directory to set things to. For this 
> reason, I don't know that one could generally set default-directory in 
> vc-call-backend.

You are right. But we could set it in vc-state-refresh.

> It could make sense to set default-directory for 
> vc-git--run-command-string (although to get vc-git-state to work, one 
> would still need to set it for vc-git--empty-db-p).

That's also an option, yes. But binding it on the higher level would be 
better, I think.

> It's worth nothing there seems to be inconsistency within vc-git. Some 
> commands like vc-git-checkin, vc-git-next-revision, do set 
> default-directory to the directory of the input file; other comands like 
> vc-git-merge-branch seem to do the opposite and assume the root is 
> already given by default-directory.

True. Some of those occurrences are most likely there just so the DIR 
argument is not left unused. Some have less obvious reasons.

vc-git-checkin, for instance, does it to call 'git commit' from the 
repository root, instead of an arbitrary directory in it. I'm sure it's 
really necessary, though.

> At the very least, the documentation for vc-git-state should note that 
> default-directory needs to be set.

The backend-specific functions are largely internal, we don't expect 
clients to call them directly. If anything, the documentation can be 
clarified on whether an arbitrary backend's 'state' command should set 
default-directory, or use the current one.

> You're right, in principle, but atom handles it by coloring directories 
> based on if they have modified files within. I don't know if there is a 
> "canonical" way to do this, although one idea would be to return a list 
> of all file status in the directory, e.g. `(up-to-date modified ignored)`.

Yeah, diff-hl-dired does something like that. If all the "interesting" 
statuses in a directory are the same, we assign it that status. If 
they're mixed, we mark it as "changed".




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 10 Apr 2017 23:46:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 10 19:46:50 2017
Received: from localhost ([127.0.0.1]:41703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxj1G-0006iM-MY
	for submit <at> debbugs.gnu.org; Mon, 10 Apr 2017 19:46:50 -0400
Received: from mail-wm0-f66.google.com ([74.125.82.66]:32769)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1cxj1E-0006i9-Vw
 for 26066 <at> debbugs.gnu.org; Mon, 10 Apr 2017 19:46:49 -0400
Received: by mail-wm0-f66.google.com with SMTP id o81so12155813wmb.0
 for <26066 <at> debbugs.gnu.org>; Mon, 10 Apr 2017 16:46:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=HAPhX4dostMUXBi2mzENjqyMqm7DtrcQiHhQb0J6MAA=;
 b=pcq/wLafBr1TeEfC+Ffj0y1bgpIJuOosMgyU8rl1yL0yXveeNCVT80INcwGuCD5qIc
 ff2GsFJDLohG8rQLFeRpBDfK2FfLqPZvWcKV8F2Qs2KS8V+vZb4IoV+nHsc9grjm9TY+
 GWiOyuuEMRMb5fYqccC86W8qRDWRFMcTHXxok+gUZ5M5W6YDmNIOo3DF307RXQK9w2gE
 MmdXeHXJ7C7VNYjNwNMKOTjzJ8Eq5Jun9WHTeP0znzv6Jz0VhG5gDO4B6xW81ySMtp5y
 KvVsQahDel3E6vgLgFj9ikg9w+Zf9Hv3ni7adVNBh9t4N1BFeQaQpa7cNWmL3eDgsETO
 0w4g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=HAPhX4dostMUXBi2mzENjqyMqm7DtrcQiHhQb0J6MAA=;
 b=aEzd/D5ZuASrGrMp+sNmMT41NZJdHienNFoH6Ot9U81K5a83vdgtPoZ+gDWUSDDhfG
 fD8W3UfHMhahIACYTPIjsoNxJihoGGpFRMF5IZTc0wxBsaKVPrzC8zpMRfRXd/TEbtiX
 wMUk8UVfSBkF4yBrJ+bYxPJ2u/13uzDqnAwlOQLQpvIMy6RPqrgkqyhYbsat8N7HdbMS
 JD7rjpTx1YMzdRWV29MFqa3hnds/vBdftfSpGsbfXIVkbh30GV4A6G1qIwv+h6HzEB4o
 Bx4lfLeervd9bLGe/7xBA8vcdFM4wJwzKCRB+N6rFPhpoPZV0vslHYfZh4gwTfIo7PvM
 6mRQ==
X-Gm-Message-State: AN3rC/521ict+KdB5OaclWDNoDbzHeV/YNzPVYbogbN5Wx2fZsh7zIOR4ox5R2k/kU1zRA==
X-Received: by 10.28.107.13 with SMTP id g13mr11596219wmc.117.1491868003350;
 Mon, 10 Apr 2017 16:46:43 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.173.156])
 by smtp.googlemail.com with ESMTPSA id 32sm19243520wrq.25.2017.04.10.16.46.41
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 10 Apr 2017 16:46:42 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Jonathan Ganc <jonganc@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
 <85978a9c-8b2f-484b-1330-be915fe05085@HIDDEN>
 <39da25d7-95d1-5b23-f5b1-c6b996aaece7@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <68331a1a-b4c4-ac7f-b047-ceb6174d1217@HIDDEN>
Date: Tue, 11 Apr 2017 02:46:40 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.0
MIME-Version: 1.0
In-Reply-To: <39da25d7-95d1-5b23-f5b1-c6b996aaece7@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

On 10.04.2017 07:41, Jonathan Ganc wrote:
> I agree with the suggestions from both of you and have made the 
> corrections. I have attached a new patch. Please let me know if you have 
> further thoughts.

Thanks. I guess the main thing left is to decide whether vc-git-state 
should bind default-directory. For example, vc-bzr-state doesn't, while 
vc-hg-state does.

Does this binding affect the command output, in this particular case?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 10 Apr 2017 23:26:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 10 19:26:48 2017
Received: from localhost ([127.0.0.1]:41693 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxihr-0006Cv-UK
	for submit <at> debbugs.gnu.org; Mon, 10 Apr 2017 19:26:48 -0400
Received: from mail-wm0-f48.google.com ([74.125.82.48]:35731)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1cxihq-0006Cf-Dz
 for 26066 <at> debbugs.gnu.org; Mon, 10 Apr 2017 19:26:46 -0400
Received: by mail-wm0-f48.google.com with SMTP id w64so50656858wma.0
 for <26066 <at> debbugs.gnu.org>; Mon, 10 Apr 2017 16:26:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=GUTNmxxnIFLD55wHMy5zmAHj7vps55oB9vXkUtIqpJM=;
 b=T532BHU6jCTXTBhLT1agD7R2R53H9sbTZbQ5sxnLdYi0m+If6J/CngeuMge7oEuzCw
 c1MTDRR/ilBbPahTn6Df1+6deXwDpSd2FFwH7CGYG8gMT0OcqKg/Bjkz+GoCehRefGBg
 o5pigrcx+tBFWVwHkX9zoAuTrhhHq5mKegmMAfxR1FBinNwsSYLBtGh4OFZ5Pw5Digzv
 pdJRFO+Pn1nh4TkyHvxut/6MV2h5Jc8APmQem/80GeaCPaWndoQlRwWM5DRUl11CVJKP
 AHeM/uyPmNYkSVOnLm2hiiCibKxKXbG+Gr3YZrrOURIXapCQgCT+p8BrU6GHT4ITcqT1
 mU4w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=GUTNmxxnIFLD55wHMy5zmAHj7vps55oB9vXkUtIqpJM=;
 b=Fan+Zc212wv/vPPbPU2iFSbj7J9XrBeoxZADq4nOHxTKxW1ryzJwb7YjQ4ZO1j27+H
 uM7q9OG8Gme8QYJ9Gg8SR0SE61lzk8XeHyPlvRpNUsy+xZ1pkvPL2mcY9JDuMSZJwozp
 zeelCorYN46gI9Rcgbx/SA7u5WoCkE3N8B844y3KCK4cppk0B+bunNWhnp0MQhpLJ7sB
 rDnjnPUZKot1aBCysi54xffA+Ugwyk7gzCFsnnkJAqjV4V820t6MKhJnADTDswfA0kFH
 vGi1uEY077LIPmE8cNzFRWQk3EMqjiNXbYAOLJBQEuU1o2b6+jYewWi73lFPSH/++o+6
 f2Tw==
X-Gm-Message-State: AN3rC/6ku7BjoZlLxR424p6eHOy5iWdZNe2JgOVstSRPw7g3ULwKbyA7
 Db+dzmaQfhCzJg==
X-Received: by 10.28.236.135 with SMTP id h7mr10547693wmi.74.1491866800847;
 Mon, 10 Apr 2017 16:26:40 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.173.156])
 by smtp.googlemail.com with ESMTPSA id q129sm1184375wmg.1.2017.04.10.16.26.39
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 10 Apr 2017 16:26:40 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Jonathan Ganc <jonganc@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
 <85978a9c-8b2f-484b-1330-be915fe05085@HIDDEN>
 <60e28ad2-a875-617d-5a8d-5e17caab21fd@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <e5dae23a-9532-21f6-6880-fc2f79be8fda@HIDDEN>
Date: Tue, 11 Apr 2017 02:26:39 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.0
MIME-Version: 1.0
In-Reply-To: <60e28ad2-a875-617d-5a8d-5e17caab21fd@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

On 10.04.2017 07:43, Jonathan Ganc wrote:
> BTW, Dmitry, I've started using Diff-Hl and it's really nice!

I'm glad you like it :)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 10 Apr 2017 07:32:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 10 03:32:33 2017
Received: from localhost ([127.0.0.1]:40495 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxToP-00063J-AV
	for submit <at> debbugs.gnu.org; Mon, 10 Apr 2017 03:32:33 -0400
Received: from mail.agora-net.com ([67.59.132.6]:55873)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ttn@HIDDEN>) id 1cxToN-00063B-ML
 for 26066 <at> debbugs.gnu.org; Mon, 10 Apr 2017 03:32:31 -0400
Received: from ttn by mail.agora-net.com with local (Exim 4.82)
 (envelope-from <ttn@HIDDEN>)
 id 1cxToM-0002nK-Mg; Mon, 10 Apr 2017 03:32:30 -0400
Received: from ttn by zigzag.favinet with local (Exim 4.80)
 (envelope-from <ttn@HIDDEN>)
 id 1cxTrR-00061E-Mb; Mon, 10 Apr 2017 09:35:41 +0200
From: Thien-Thi Nguyen <ttn@HIDDEN>
To: 26066 <at> debbugs.gnu.org
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
 <85978a9c-8b2f-484b-1330-be915fe05085@HIDDEN>
 <39da25d7-95d1-5b23-f5b1-c6b996aaece7@HIDDEN>
Mail-Followup-To: 26066 <at> debbugs.gnu.org
Date: Mon, 10 Apr 2017 09:35:28 +0200
In-Reply-To: <39da25d7-95d1-5b23-f5b1-c6b996aaece7@HIDDEN> (Jonathan Ganc's
 message of "Mon, 10 Apr 2017 00:41:15 -0400")
Message-ID: <87fuhgd8an.fsf@zigzag>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha1; protocol="application/pgp-signature"
X-SA-Exim-Connect-IP: <locally generated>
X-SA-Exim-Mail-From: ttn@HIDDEN
X-SA-Exim-Scanned: No (on mail.agora-net.com); SAEximRunCond expanded to false
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 26066
Cc: Jonathan Ganc <jonganc@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: 26066 <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


() Jonathan Ganc <jonganc@HIDDEN>
() Mon, 10 Apr 2017 00:41:15 -0400

   +      (while (string-match "\\(..\\) [^\0]+\0" status next-match)
   +        (push (match-string 1 status) code-list)
   +        (setq next-match (match-end 0)))
   +      (setq code-list (nreverse code-list))

You can also use something like:

 (mapcar (lambda (s)
           (substring s 0 2))
         (split-string status "\0"))

to compute the value of =E2=80=98code-list=E2=80=99.  Might be quicker, too.

=2D-=20
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
=2D-------------------------------------- 6CE4 6703 2224 4C80 7502


--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAljrNcQACgkQZwMiJEyAdQLNuACgn/yzkHpitD6NitcHEYnDrs/z
LFkAniQNn+RHPUabYX6PG8dpmGex053o
=F6Uc
-----END PGP SIGNATURE-----
--=-=-=--





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 10 Apr 2017 06:05:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 10 02:05:23 2017
Received: from localhost ([127.0.0.1]:40442 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxSS3-0003uk-EE
	for submit <at> debbugs.gnu.org; Mon, 10 Apr 2017 02:05:23 -0400
Received: from eggs.gnu.org ([208.118.235.92]:55499)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1cxSS2-0003uY-3R
 for 26066 <at> debbugs.gnu.org; Mon, 10 Apr 2017 02:05:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1cxSRr-0000HA-Ui
 for 26066 <at> debbugs.gnu.org; Mon, 10 Apr 2017 02:05:16 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33984)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1cxSRr-0000H6-Rv; Mon, 10 Apr 2017 02:05:11 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1683
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1cxSRq-0004WA-WC; Mon, 10 Apr 2017 02:05:11 -0400
Date: Mon, 10 Apr 2017 09:05:25 +0300
Message-Id: <83inmclrve.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jonathan Ganc <jonganc@HIDDEN>
In-reply-to: <39da25d7-95d1-5b23-f5b1-c6b996aaece7@HIDDEN> (message from
 Jonathan Ganc on Mon, 10 Apr 2017 00:41:15 -0400)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
 <85978a9c-8b2f-484b-1330-be915fe05085@HIDDEN>
 <39da25d7-95d1-5b23-f5b1-c6b996aaece7@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 26066
Cc: npostavs@HIDDEN, 26066 <at> debbugs.gnu.org, dgutov@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

> From: Jonathan Ganc <jonganc@HIDDEN>
> Date: Mon, 10 Apr 2017 00:41:15 -0400
> 
> I will gladly sign a copyright assignment, if you point me to where I 
> can do that.

I sent the form off-list.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 10 Apr 2017 04:43:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 10 00:43:43 2017
Received: from localhost ([127.0.0.1]:40428 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxRB0-0001pV-Te
	for submit <at> debbugs.gnu.org; Mon, 10 Apr 2017 00:43:43 -0400
Received: from mail-qt0-f194.google.com ([209.85.216.194]:32877)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cxRAz-0001pJ-Um
 for 26066 <at> debbugs.gnu.org; Mon, 10 Apr 2017 00:43:42 -0400
Received: by mail-qt0-f194.google.com with SMTP id c45so9047758qtb.0
 for <26066 <at> debbugs.gnu.org>; Sun, 09 Apr 2017 21:43:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding;
 bh=gxUiXPBGze4QOoXWPgNyZg66/AiXKPpM8l8kurLS1j8=;
 b=qAEKniaB0xGAMw+a5EJzp3Sagz0i2GlAuvngX327qASCnzL/7pxY4l1QQQxv180khD
 1HQRR2Hmm+t0RY5xgQ0lkEiDNn4ZU0DoUu5KP0JPXay3u5mtEsPu5OEsOouNhXNCtWdf
 O6zbuxsQcrEAJ5RrF/GfEeutNxA/W0pQ5legkIzx/nVP0nONaZ8AWpgxW9uzFZUpVIvJ
 IWYU00fgtcmwuGc7k/DeM6+umbiA2OioA524Mb/ftbxCBkAAoodTy0s+i9cEoM/k2ta5
 VS1ZBj7c83KYfVbrK6gyBJAHN9wTaCV9aC2cwZmP2fvfcbRgYKBPjcnN5v6OXNNwrTgo
 f1fg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=gxUiXPBGze4QOoXWPgNyZg66/AiXKPpM8l8kurLS1j8=;
 b=FYb3TlY95aLUR3vTcMiyBPU5e7+ZENui+r1lZ47oeyFwTXAyWR3ZpPngkzCbFVlY9A
 9dZvZof2z+TWySO9eTSJVoIWYTyH6ZmOFc00fBDsNs8wz+39LUBcnSYOqyeZOsA0kv7D
 uof+R8Gd4y0nlo05M4fYIRt/9Ct539XeuP0znjwtKMRETMvFb0jaKSWiYu50fzLWqKJs
 CQzwUhrPPcF8SV+8GQPoqV7zVDmxXyTfizcMttVbRTQeIH0L2/eI0lh4SQC1AZw1iYqt
 0CSrLVIthdIfD+o6Dv/YOjcT5gPvaiq2XOJR1iVs31ZsHLajUascfQDH3qiHEIdQ3LXZ
 n2Bw==
X-Gm-Message-State: AN3rC/5uxHzrv9bupfI0tJUGuKLT+XPQ2sqdcEf2mDL2UIj3u98R1U6ydrux+V5RMH6oyw==
X-Received: by 10.200.53.202 with SMTP id l10mr5232945qtb.133.1491799416607;
 Sun, 09 Apr 2017 21:43:36 -0700 (PDT)
Received: from [192.168.1.200] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id s3sm8096500qte.57.2017.04.09.21.43.35
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 09 Apr 2017 21:43:36 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
 <85978a9c-8b2f-484b-1330-be915fe05085@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <60e28ad2-a875-617d-5a8d-5e17caab21fd@HIDDEN>
Date: Mon, 10 Apr 2017 00:43:35 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <85978a9c-8b2f-484b-1330-be915fe05085@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

BTW, Dmitry, I've started using Diff-Hl and it's really nice!


On 04/09/2017 11:26 PM, Dmitry Gutov wrote:
> On 31.03.2017 06:16, Jonathan Ganc wrote:
>> +  (save-match-data
>> +    (let* ((default-directory (file-name-directory (expand-file-name 
>> file)))
>
> We don't require or expect that any particular function keeps the 
> match data intact. I don't think that save-match-data is needed here.
>
> Aside from this an Noam's comments, the patch is long enough to 
> require a copyright assignment. I didn't find yours on file.
>
> Will you sign one?





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 10 Apr 2017 04:41:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 10 00:41:24 2017
Received: from localhost ([127.0.0.1]:40424 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxR8m-0001mA-E2
	for submit <at> debbugs.gnu.org; Mon, 10 Apr 2017 00:41:24 -0400
Received: from mail-qt0-f193.google.com ([209.85.216.193]:34522)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cxR8k-0001lx-6D
 for 26066 <at> debbugs.gnu.org; Mon, 10 Apr 2017 00:41:22 -0400
Received: by mail-qt0-f193.google.com with SMTP id r49so4750035qta.1
 for <26066 <at> debbugs.gnu.org>; Sun, 09 Apr 2017 21:41:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to; bh=TR1miUIinQmx6rni6Mk6W9CYwlJuejRgn2J+iEmhHIk=;
 b=n7n740qG+/XYuxtsEkjztZ3T4Xn3CPStwsZ8n6PTR0x1CAbETMTnHo1U9TSH2MKZkX
 agGVh2nmvQb4B/+2d7siWrHlSM2bX74XnhJzzjxdCKp6cOoRz5hhL5wXkompiPV4ECtg
 G/sTc1njY7jzJBqe1oI08EkbDLm6HWihZZ81LJXIyv2tP3ZiRcsrJ3r7qUx5+k/jsbxo
 jpk0Vzw40pNawD80De06LzGL5E35La+MfitpRxOIppr5YfPPPctFdfoo77PpePHZoWJa
 fjOCQG5f2yfjBikbS4SeWPrxpZqoAwPxSen0iWw620JB6uwfYYxCQcui1Ub4Sfu+cu4+
 CiEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to;
 bh=TR1miUIinQmx6rni6Mk6W9CYwlJuejRgn2J+iEmhHIk=;
 b=iqvxI1z+gTun19pj4c8TukIwTAXe5iA07nuidX+yg2ho+YDvGX6k0hxg+EADPhQsGK
 qYwG5t4mqPwUP7qunAZEXO8+g/RhPilVLa0d7rNvFer0S9zy1akLGElhV7vPIFpUilWD
 Eaim54TT4Y/ji7bsK5PkvMKfbFdZh8WQn/r+CKOrNCIrIf1hlVPNFnVOJ2d3OqqPbhxs
 aYM/p/CyIDN0tO/wzAAKdtCwZJ/q9wZkY5khuTrVPzjSL8D7dEoAakRMZDpRrwjmlTrw
 0hoEz8QsA1ZKkzaCjt8udR431lWHQk4X22Y4PKEe8WCksN8zq2MQpYw6BQRoL5hvBU7w
 zAxA==
X-Gm-Message-State: AFeK/H2TibY3OcREeC7fzKMJ82Hx8H8cpuUWxWGZv9S5fY+Fg6GCa8fsK4iZLvOmIzobHg==
X-Received: by 10.237.33.251 with SMTP id m56mr55538830qtc.121.1491799276676; 
 Sun, 09 Apr 2017 21:41:16 -0700 (PDT)
Received: from [192.168.1.200] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id 44sm8126057qts.15.2017.04.09.21.41.15
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 09 Apr 2017 21:41:15 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
 <85978a9c-8b2f-484b-1330-be915fe05085@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <39da25d7-95d1-5b23-f5b1-c6b996aaece7@HIDDEN>
Date: Mon, 10 Apr 2017 00:41:15 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <85978a9c-8b2f-484b-1330-be915fe05085@HIDDEN>
Content-Type: multipart/mixed; boundary="------------4F537D67227018580F1D0513"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

This is a multi-part message in MIME format.
--------------4F537D67227018580F1D0513
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

I agree with the suggestions from both of you and have made the 
corrections. I have attached a new patch. Please let me know if you have 
further thoughts.

I will gladly sign a copyright assignment, if you point me to where I 
can do that.


On 04/09/2017 11:26 PM, Dmitry Gutov wrote:
> On 31.03.2017 06:16, Jonathan Ganc wrote:
>> +  (save-match-data
>> +    (let* ((default-directory (file-name-directory (expand-file-name 
>> file)))
>
> We don't require or expect that any particular function keeps the 
> match data intact. I don't think that save-match-data is needed here.
>
> Aside from this an Noam's comments, the patch is long enough to 
> require a copyright assignment. I didn't find yours on file.
>
> Will you sign one?


--------------4F537D67227018580F1D0513
Content-Type: text/x-patch;
 name="0001-update-vc-git.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-update-vc-git.patch"

From 78bcdd00927bc8f14ef2999b8bf0b4ad25ab6dac Mon Sep 17 00:00:00 2001
From: Jonathan Ganc <jonganc@HIDDEN>
Date: Mon, 10 Apr 2017 00:38:52 -0400
Subject: [PATCH] update vc-git

---
 lisp/vc/vc-git.el | 75 ++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 49 insertions(+), 26 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 1a3f1bf..a8d686a 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -231,34 +231,57 @@ (defun vc-git--state-code (code)
     (?U 'edited)     ;; FIXME
     (?T 'edited)))   ;; FIXME
 
+(defun vc-git--git-status-to-vc-state (code-list)
+  "Convert a list CODE-LIST of two-letter git status strings to a vc status.
+
+Each element of CODE-LIST comes from the first two characters of
+a line returned by 'git status' and should be passed in the order given by 'git status'.
+
+\(It is necessary to allow CODE-LIST to be a list because
+sometimes git status returns multiple lines, e.g. for a file that
+is removed from the index but is present in the HEAD and working
+tree.) "
+  (pcase code-list
+    ('nil 'up-to-date)
+    (`(,code)
+     (pcase code
+       ("!!" 'ignored)
+       ("??" 'unregistered)
+       ;; I have only seen this with a file that is only present in the
+       ;; index.  Let us call this `removed'
+       ("AD" 'removed)
+       (_ (cond
+           ((string-match-p "^[ RD]+$" code) 'removed)
+           ((string-match-p "^[ M]+$" code) 'edited)
+           ((string-match-p "^[ A]+$" code) 'added)
+           ((string-match-p "^[ U]+$" code) 'conflict)
+           (t 'edited)))))
+    ;;  I know of two times when git state returns more than one element,
+    ;;  in both cases returning '("D " "??")':
+    ;;  1. when a file is removed from the index but present in the
+    ;;     HEAD and working tree
+    ;;  2. when a file A is renamed to B in the index and then back to A
+    ;;     in the working tree
+    ;;  In both these instances, `unregistered' is a reasonable response.
+    (`("D " "??") 'unregistered)
+    ;;  In other cases, let us return `edited'.
+    (_ 'edited)))
+
 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
-  ;; FIXME: This can't set 'ignored or 'conflict yet
-  ;; The 'ignored state could be detected with `git ls-files -i -o
-  ;; --exclude-standard` It also can't set 'needs-update or
-  ;; 'needs-merge. The rough equivalent would be that upstream branch
-  ;; for current branch is in fast-forward state i.e. current branch
-  ;; is direct ancestor of corresponding upstream branch, and the file
-  ;; was modified upstream.  But we can't check that without a network
-  ;; operation.
-  ;; This assumes that status is known to be not `unregistered' because
-  ;; we've been successfully dispatched here from `vc-state', that
-  ;; means `vc-git-registered' returned t earlier once.  Bug#11757
-  (let ((diff (vc-git--run-command-string
-               file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))
-    (if (and diff
-             (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0\\(.*\n.\\)?"
-                           diff))
-        (let ((diff-letter (match-string 1 diff)))
-          (if (not (match-beginning 2))
-              ;; Empty diff: file contents is the same as the HEAD
-              ;; revision, but timestamps are different (eg, file
-              ;; was "touch"ed).  Update timestamp in index:
-              (prog1 'up-to-date
-                (vc-git--call nil "add" "--refresh" "--"
-                              (file-relative-name file)))
-            (vc-git--state-code diff-letter)))
-      (if (vc-git--empty-db-p) 'added 'up-to-date))))
+  (let* ((default-directory (file-name-directory (expand-file-name file)))
+           (status
+            (vc-git--run-command-string file "status" "--porcelain" "-z"
+                                        "--untracked-files" "--ignored" "--"))
+           code-list (next-match 0))
+      ;; If this code is adapted to parse git-status for a directory, note
+      ;; that a renamed file takes up two null values and needs to be
+      ;; treated slightly more carefully.
+      (while (string-match "\\(..\\) [^\0]+\0" status next-match)
+        (push (match-string 1 status) code-list)
+        (setq next-match (match-end 0)))
+      (setq code-list (nreverse code-list))
+      (vc-git--git-status-to-vc-state code-list)))
 
 (defun vc-git-working-revision (_file)
   "Git-specific version of `vc-working-revision'."
-- 
2.9.3


--------------4F537D67227018580F1D0513--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 10 Apr 2017 03:26:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 09 23:26:27 2017
Received: from localhost ([127.0.0.1]:40399 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxPyF-0008SK-9N
	for submit <at> debbugs.gnu.org; Sun, 09 Apr 2017 23:26:27 -0400
Received: from mail-wm0-f48.google.com ([74.125.82.48]:34473)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1cxPyC-0008S6-Sm
 for 26066 <at> debbugs.gnu.org; Sun, 09 Apr 2017 23:26:25 -0400
Received: by mail-wm0-f48.google.com with SMTP id w204so6354994wmd.1
 for <26066 <at> debbugs.gnu.org>; Sun, 09 Apr 2017 20:26:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=cw/zgMOV89TGpD5htuQMdd3DJvtK8l8jAUdYm116MBw=;
 b=W2bqSYIwbQVmU5LYA344cV+jud95MZoXPGHA4KKXK6Rb1W7euzGqv+XOtcaeF1+WOP
 Otm0QhBwmJ8cIUmCUQ3VM9Q2Jt8m++THE1XdV0cx4qw8YDazoAaCFfPLoynvo7S1gmsp
 f+Hrmb6FgzjS3W4wX7WfsrpBUxWileFJpiK9u6b3ANPnLG0YzqOObGH4I8NxEqw8GzSC
 OznqvLvb40LMRUtNROZ9TgMWCId/EynQk96O2witpS68WHC05OhMnfy1Un5mYzRv+kLu
 MY9ofFjYVsgM8JDQIXsj8v11sAaSWxFoZXT+ct+cv9yhPTjQd5aon4Ocga3YHj+Adw/z
 QgXw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=cw/zgMOV89TGpD5htuQMdd3DJvtK8l8jAUdYm116MBw=;
 b=Z36Sb/e3ndIf/mZKrS459sYiQyzRZR8XpXpGVq9yJg5U0ZR1pl4b7t1by3zxDLnZYS
 d7jbeBucm+T2oSSTU5Z8sOHyXAzhzMhAkumW5qjtB2zGXi26BvyZgtvqE0WOfJ3eYYSv
 /2sUYn3zxcyiMqRO4PvUeTJ4Mwbb3mCN6Cgv9b8SemxG1S1psPaUdq7+6vzqzIoW4AH5
 VxWfr83HSY9fjFmGY/4Onu6Dox1Djh8KYpHZvlhKoeJo0WL9qYn/pUShtX53cuHfnUSv
 BWRtMfnPaOVlg1bowhnOeSTrfbBnpYsgVwrTwjmpmLxu63bcjprO4HWhgiaQcy/kN7V5
 vwTA==
X-Gm-Message-State: AN3rC/7xWIextqYrxBa6oQymkQds/ymPpbSKESmm8tDqXeWbAWq+gMwJ
 GSGNWc4qJZW6sQ==
X-Received: by 10.28.212.67 with SMTP id l64mr8446906wmg.76.1491794779023;
 Sun, 09 Apr 2017 20:26:19 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.173.156])
 by smtp.googlemail.com with ESMTPSA id u145sm8434664wmu.1.2017.04.09.20.26.17
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 09 Apr 2017 20:26:18 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Jonathan Ganc <jonganc@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <85978a9c-8b2f-484b-1330-be915fe05085@HIDDEN>
Date: Mon, 10 Apr 2017 06:26:16 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.0
MIME-Version: 1.0
In-Reply-To: <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

On 31.03.2017 06:16, Jonathan Ganc wrote:
> +  (save-match-data
> +    (let* ((default-directory (file-name-directory (expand-file-name file)))

We don't require or expect that any particular function keeps the match 
data intact. I don't think that save-match-data is needed here.

Aside from this an Noam's comments, the patch is long enough to require 
a copyright assignment. I didn't find yours on file.

Will you sign one?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 10 Apr 2017 02:56:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 09 22:56:54 2017
Received: from localhost ([127.0.0.1]:40389 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxPVd-0007la-RS
	for submit <at> debbugs.gnu.org; Sun, 09 Apr 2017 22:56:54 -0400
Received: from mail-io0-f195.google.com ([209.85.223.195]:34968)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1cxPVc-0007lL-3l
 for 26066 <at> debbugs.gnu.org; Sun, 09 Apr 2017 22:56:52 -0400
Received: by mail-io0-f195.google.com with SMTP id t68so1355749iof.2
 for <26066 <at> debbugs.gnu.org>; Sun, 09 Apr 2017 19:56:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=yz6uGAAcD02pR7/J1unlhmHLhE8cCpIN7XLOhnBnKYg=;
 b=m11TZ7XIPFj4MGEoukohghTgQpkI+UcXf4Mtf1tJgkx4uD0O3gqTN3K7U+/Wc9Wg3i
 Z5t+edu6/NtPL6j8GOlqTfsxXVT8v643Ony/0pL5MRx8lijSrGnZUYjCjlE+0Iat/rzr
 nE5AJUMQkSD03n0ycKv4HI6RdjBY5YrsnhFUFK0GvzAWN1QVTymtrKEuSLhN7782aXFq
 64C1uP9IWAn2ZedsacA3kPDZb0NIu79teRoMkt5FOAqVJGVntRdm49tvLq+r80mcW8S2
 CbT/m699FTzC1CXvr4wRL0/mN0FlPaT0Eq+UdAf7XDHXJEuX5TLGuT0JWPND07r0Mt86
 WlKw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=yz6uGAAcD02pR7/J1unlhmHLhE8cCpIN7XLOhnBnKYg=;
 b=k/tI/Tqr/cm7n27y9mGWFFCR7IuKYBP2XchdViyxXzRyrALH8MBR/KMfKASSnA4zIC
 rpoo32BzPs4ccZyMJc00KB02tuTffHy/H/Mkszjb1+dn67E4nsppzdZPT3we/F9n1tUa
 lsDtaGnzz5aYmFUuDoZJF1c6HjNs7XvrJqOHKJPOafwybvCNGsfEYozsUCnayj0Qoy3d
 J1VbTmLUeg1EIaIY9FE0B8eziO+O55GRZB9XgF/PvWj3x8Vz9JripeXPzpUDmX53YNOc
 T4XZozBzRuuP0y2KqUMWuyr5ZYEfNPleIx3Ts1olLfuLPLxJ5PzRGU5Gk35XopTMspeJ
 UCKw==
X-Gm-Message-State: AN3rC/4yY8UC2ZSKJEH34z0d546F9w254FK7RkR81MzN3Y0DhYIlqC5EzFeCxSe/jsAjQA==
X-Received: by 10.107.6.6 with SMTP id 6mr11066758iog.78.1491793006503;
 Sun, 09 Apr 2017 19:56:46 -0700 (PDT)
Received: from zony ([45.2.7.65])
 by smtp.googlemail.com with ESMTPSA id u63sm439624itb.16.2017.04.09.19.56.45
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 09 Apr 2017 19:56:46 -0700 (PDT)
From: npostavs@HIDDEN
To: Jonathan Ganc <jonganc@HIDDEN>
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
Date: Sun, 09 Apr 2017 22:58:11 -0400
In-Reply-To: <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN> (Jonathan Ganc's
 message of "Thu, 30 Mar 2017 23:16:02 -0400")
Message-ID: <87inmdt1do.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 26066
Cc: 26066 <at> debbugs.gnu.org, Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

Jonathan Ganc <jonganc@HIDDEN> writes:

>  
> +(defun vc-git--git-status-to-vc-state (code-list)

> +  (setq code-list (remq nil code-list))
> +  (pcase code-list
> +    ('nil 'up-to-date)

You seem to be handling nil in 2 different ways.

> +       ;; have only seen this with a file that is only present in the
> +       ;; index. let us call this `removed'

Comments should be full sentences (start with uppercase, end with
period), and sentences should be separated with double spaces.

>  (defun vc-git-state (file)
>    "Git-specific version of `vc-state'."
> +  
> +  (save-match-data
> +    (let* ((default-directory (file-name-directory (expand-file-name file)))
> +           (status
> +            (vc-git--run-command-string file "status" "--porcelain" "-z"
> +                                        "--untracked-files" "--ignored" "--"))
> +           code-list)

> +      (while (string-match "^\\(..\\)[^\0]+\0\\(\\(?:a\\|[^a]\\)*\\)$" status)

I think you're missing a space after the first 2 characters.

    alternate -z format recommended for machine parsing. [...] Second, a
    NUL (ASCII 0) follows each filename, [...] (but a space still
    separates the status field from the first filename).

> +        (add-to-list 'code-list (match-string 1 status) t 'ignore)

Don't use `add-to-list' on local variables.  The usual idiom for
collecting a series of items in a list would be

    (let ((code-list nil))
      (while ...
        (push ... code-list))
      (setq code-list (nreverse code-list)))

> +        (setq status (match-string 2 status)))

Instead of matching the rest of the string in the regexp, just set a
position variable to (match-end 0), and then pass that position as the
string-match's START parameter.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 10 Apr 2017 02:16:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 09 22:16:34 2017
Received: from localhost ([127.0.0.1]:40352 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxOsb-0006ns-QS
	for submit <at> debbugs.gnu.org; Sun, 09 Apr 2017 22:16:34 -0400
Received: from mail-qk0-f195.google.com ([209.85.220.195]:36540)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cxOsa-0006ne-Jy
 for 26066 <at> debbugs.gnu.org; Sun, 09 Apr 2017 22:16:32 -0400
Received: by mail-qk0-f195.google.com with SMTP id v75so17313314qkb.3
 for <26066 <at> debbugs.gnu.org>; Sun, 09 Apr 2017 19:16:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding;
 bh=zY7GKnVSlZIG+/JTjjgKh2YLqemWEKGSJMkcDBOkJbc=;
 b=hBZa0YnUTRxx6SYEFp3qSJiecCLh8hkpSZfmayExiMwakXL0n9nV/mAflaM2GrBRgS
 4psmfWcnOiO0+gqRjX1n3MRbU7+LsjI98tfEwN26dWntc7liU5OzHK19zr4J4xuohuaS
 hD2Vwa/eg7yQbKgMQxWvV/dN9aMgCeHJxKqcrYH32VICvlqGqP8f3ddDfSrwZ+Oh5s7o
 LDWfxr1v5zdxHCwt7BYUsp97bNrjtqVzwjTIH4MbsBt3pI4pOB2ETEFSMQi9YL6Zo2nF
 rF2pxL5xI96vTvs4z7MAV+PZmrsASNZ9+OOgMq3K5Q2rj27UjIfZMmtPlVacykW1MNSW
 bh9A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=zY7GKnVSlZIG+/JTjjgKh2YLqemWEKGSJMkcDBOkJbc=;
 b=HyVdEiIna7pZmO6q/I/RIxbFBfoIkq2tvCihJem4/AabsFlKviul+N/3yPiFB9h2+M
 LJzFkMHNWVrFRWBOboth7c7lW5LFZNc6yraJrv2fyiZbW2QOsFr9pJSndnCBYd8xeOsa
 p4aMrE3aknt8XnxT09hKHU/pq9B+Mec8UmRFrcSzs7gMJ9Paxp1dbPNfL2domnOaDFWF
 ncUSsItF2xNjnzpCbTBQrc12VSIPxFp4mf/eFmclkiW2GmOG5m3e13CWIJE/QHwR/cMY
 ESpQjJDB16av9m+y4OmR/6V1qhlsvqu72aU04+3IVE6vMwerxXk1m/KdmksiBQar4Z8H
 hnsw==
X-Gm-Message-State: AFeK/H2nOoZU46LlMBXpvfzptY8laUuyt/O7Z8LibcejaeSiCRZ7RCbASKQYPi7SdbwCAg==
X-Received: by 10.55.31.1 with SMTP id f1mr41404392qkf.255.1491790587028;
 Sun, 09 Apr 2017 19:16:27 -0700 (PDT)
Received: from [192.168.1.200] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id z4sm7903233qkc.68.2017.04.09.19.16.25
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 09 Apr 2017 19:16:26 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
 <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <22831afe-cda8-2061-f747-8eb457943e49@HIDDEN>
Date: Sun, 9 Apr 2017 22:16:24 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

Hi,

I am just checking if anyone has had a chance to review my proposed 
improvement to vc-git-status? I have been using it without problem but I 
would love to get feedback.

Jonathan


On 03/30/2017 11:16 PM, Jonathan Ganc wrote:
> I have attached my proposed patch to use 'git status' for finding the 
> git status of files.
>
> I have also attached git-test.sh, which generates a subdirectory 
> git-test with files in all the relevant git states I could think of 
> (if you use it, look at the mods, repo2, repo3 directories for 
> interesting files).
>
> I then verified that 1) my function gives the same result as 
> vc-git-dir-status-files where vc-git-dir-status-files shows the file, 
> with one exception: if a file has a merge conflict (i.e. the status is 
> "UU"), my function returns conflict; 2) it is the same speed as the 
> current vc-git-state.
>
> I may try eventually try rewriting vc-git-dir-status-files using this 
> since it appears to be about an order of magnitude faster than the 
> current implementation.
>
> On 03/22/2017 10:18 PM, Jonathan Ganc wrote:
>> Hi,
>>
>> Thanks for both responses.
>>
>>
>>>> 3. It would be nice to be able to show mutiple directory trees at 
>>>> once in Neotree, though this is not as important.
>>>
>>> If it's unable to show the non-current projects, how is the bug 
>>> triggered? default-directory would have to be outside of the project.
>>
>> I'm not actually sure why it is causing me problems. I just tried 
>> using Neotree and encountered this problem. I didn't try anything 
>> special besides opening the window. I'm not sure how/why Neotree sets 
>> default-directory. I need to look into this.
>>
>>
>>> The problem might have gone unnoticed until now because file's 
>>> status is cached, and because it can only be apparent if several 
>>> projects are opened at the same time.
>>>
>>> While the problem is fairly obvious, a proper fix would most likely 
>>> touch other backends and commands, to the point that the 
>>> default-directory binding might have to be done inside vc-call-backend.
>>
>> Yeah, I'm not really sure what the workflow should be; I'm just 
>> getting started with the vc functions in emacs. One issue, though, is 
>> that default-directory can only be set for functions that identify a 
>> filename, because we need to have a directory to set things to. For 
>> this reason, I don't know that one could generally set 
>> default-directory in vc-call-backend. It could make sense to set 
>> default-directory for vc-git--run-command-string (although to get 
>> vc-git-state to work, one would still need to set it for 
>> vc-git--empty-db-p).
>>
>> It's worth nothing there seems to be inconsistency within vc-git. 
>> Some commands like vc-git-checkin, vc-git-next-revision, do set 
>> default-directory to the directory of the input file; other comands 
>> like vc-git-merge-branch seem to do the opposite and assume the root 
>> is already given by default-directory.
>>
>> At the very least, the documentation for vc-git-state should note 
>> that default-directory needs to be set.
>>
>>>
>>> There is a very simple workaround on the caller's side, though: bind 
>>> default-directory inside the Neotree code, to the respective project 
>>> root (or just the file's parent directory). That will be necessary 
>>> anyway for it to work in the released Emacs versions.
>>>
>>
>> That may be the best answer. I am not so familiar with the Neotree 
>> code but it should be doable.
>>
>>>> 2. I would like to be able to color directories as well as files. I 
>>>> don't know if that is something that would have a component in 
>>>> vc-git.el / vc-....el or would go entirely in some package (e.g. 
>>>> Neotree)
>>>
>>> This differs from one version control system to another, but Git 
>>> doesn't actually track directories. So the notion of "directory 
>>> status" is poorly defined. But see the previously mentioned 
>>> diff-hl-dired-mode.
>>>
>>
>> You're right, in principle, but atom handles it by coloring 
>> directories based on if they have modified files within. I don't know 
>> if there is a "canonical" way to do this, although one idea would be 
>> to return a list of all file status in the directory, e.g. 
>> `(up-to-date modified ignored)`.
>>
>> I started looking through diff-hl. It looks like it has a bunch of 
>> neat and useful features, though I admit I was a bit confused by the 
>> workflow.
>>
>





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 31 Mar 2017 03:16:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 30 23:16:12 2017
Received: from localhost ([127.0.0.1]:53406 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ctn2q-000333-2z
	for submit <at> debbugs.gnu.org; Thu, 30 Mar 2017 23:16:12 -0400
Received: from mail-qt0-f193.google.com ([209.85.216.193]:36435)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1ctn2o-00032q-Ji
 for 26066 <at> debbugs.gnu.org; Thu, 30 Mar 2017 23:16:11 -0400
Received: by mail-qt0-f193.google.com with SMTP id n37so8728322qtb.3
 for <26066 <at> debbugs.gnu.org>; Thu, 30 Mar 2017 20:16:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to; bh=fvXdrcDgI9xxqXfXKSX19ixlHRXimdDbxGTsDP0ExBM=;
 b=ZaftMZjQF3s/Kfe9cjdRJMISeJnkXP9zcc4ghg8Z1Iab3E8xkyat+aW6N6XSYbQAiM
 hxY5krs16FnsSa+jl+x92Vzr/0bEXTIBOic2bHPSm1CgNcrjAEh7GviHJn/wOBkuY2P1
 XejJaWlxj8ExdFmhKN7S2sOHQkP0/rpmYwfsF0MrG2eaeAyEcT/fOQ2S9fNh4jVj4UXa
 BNMFsmRUA/BahdvwT9KZZTcobbTQk8QpGvaOqyWzqtTTtkQXJZ+F364Bklf7UUuHpAut
 JsBQgilr2JW3BmYg3K6RhFk7SQTX5XyolcHzSTjd3Z4Jpg0jGoRB8HbcQGDXjAq8tb+V
 4wIw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to;
 bh=fvXdrcDgI9xxqXfXKSX19ixlHRXimdDbxGTsDP0ExBM=;
 b=qDjRhRT2II2kuS59h+xVPopRo9/1HGbEMsCgy8OUgD5S/m3i5krAx8wFHfvdfgNXiK
 8S2R/fpqGytKMt4+IHtQyrbOxxVRapzSFvBXix7MpQM6O0YzO/V9iC3t4lyDCStkj0xK
 jlfPWZUz9gPTLI1uc1H2K+1A5EiB7cUi8QBTqn0b304ogqOjCNfcbcpYlsXWcrq+pQxX
 ElVlGk7uAOv/otdqLSguoqQajBGcn73JITNPJR9k8tixjfIVc4vkYRnv0BWkrMeYw4CI
 V7xLb+B0ddl911oaofCBavQCzn75X+bQrBNv/v0OFzr0GEqDwnsKkiOgf6b5KaMOYwPL
 n0tw==
X-Gm-Message-State: AFeK/H1LvSLTLBUHK0nQbnb+daB5iL8qIbRcQrxkESQLobZs1EGXZyVhy9pfu/+tVxZ0Qw==
X-Received: by 10.237.33.46 with SMTP id 43mr798572qtc.72.1490930164877;
 Thu, 30 Mar 2017 20:16:04 -0700 (PDT)
Received: from [192.168.1.198] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id j100sm2727983qkh.38.2017.03.30.20.16.03
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 30 Mar 2017 20:16:04 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
 <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <7fccafd3-e2c2-204a-05a0-a930a4cbb7e4@HIDDEN>
Date: Thu, 30 Mar 2017 23:16:02 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
Content-Type: multipart/mixed; boundary="------------22756C2F6450B47F54C776CB"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

This is a multi-part message in MIME format.
--------------22756C2F6450B47F54C776CB
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

I have attached my proposed patch to use 'git status' for finding the 
git status of files.

I have also attached git-test.sh, which generates a subdirectory 
git-test with files in all the relevant git states I could think of (if 
you use it, look at the mods, repo2, repo3 directories for interesting 
files).

I then verified that 1) my function gives the same result as 
vc-git-dir-status-files where vc-git-dir-status-files shows the file, 
with one exception: if a file has a merge conflict (i.e. the status is 
"UU"), my function returns conflict; 2) it is the same speed as the 
current vc-git-state.

I may try eventually try rewriting vc-git-dir-status-files using this 
since it appears to be about an order of magnitude faster than the 
current implementation.

On 03/22/2017 10:18 PM, Jonathan Ganc wrote:
> Hi,
>
> Thanks for both responses.
>
>
>>> 3. It would be nice to be able to show mutiple directory trees at 
>>> once in Neotree, though this is not as important.
>>
>> If it's unable to show the non-current projects, how is the bug 
>> triggered? default-directory would have to be outside of the project.
>
> I'm not actually sure why it is causing me problems. I just tried 
> using Neotree and encountered this problem. I didn't try anything 
> special besides opening the window. I'm not sure how/why Neotree sets 
> default-directory. I need to look into this.
>
>
>> The problem might have gone unnoticed until now because file's status 
>> is cached, and because it can only be apparent if several projects 
>> are opened at the same time.
>>
>> While the problem is fairly obvious, a proper fix would most likely 
>> touch other backends and commands, to the point that the 
>> default-directory binding might have to be done inside vc-call-backend.
>
> Yeah, I'm not really sure what the workflow should be; I'm just 
> getting started with the vc functions in emacs. One issue, though, is 
> that default-directory can only be set for functions that identify a 
> filename, because we need to have a directory to set things to. For 
> this reason, I don't know that one could generally set 
> default-directory in vc-call-backend. It could make sense to set 
> default-directory for vc-git--run-command-string (although to get 
> vc-git-state to work, one would still need to set it for 
> vc-git--empty-db-p).
>
> It's worth nothing there seems to be inconsistency within vc-git. Some 
> commands like vc-git-checkin, vc-git-next-revision, do set 
> default-directory to the directory of the input file; other comands 
> like vc-git-merge-branch seem to do the opposite and assume the root 
> is already given by default-directory.
>
> At the very least, the documentation for vc-git-state should note that 
> default-directory needs to be set.
>
>>
>> There is a very simple workaround on the caller's side, though: bind 
>> default-directory inside the Neotree code, to the respective project 
>> root (or just the file's parent directory). That will be necessary 
>> anyway for it to work in the released Emacs versions.
>>
>
> That may be the best answer. I am not so familiar with the Neotree 
> code but it should be doable.
>
>>> 2. I would like to be able to color directories as well as files. I 
>>> don't know if that is something that would have a component in 
>>> vc-git.el / vc-....el or would go entirely in some package (e.g. 
>>> Neotree)
>>
>> This differs from one version control system to another, but Git 
>> doesn't actually track directories. So the notion of "directory 
>> status" is poorly defined. But see the previously mentioned 
>> diff-hl-dired-mode.
>>
>
> You're right, in principle, but atom handles it by coloring 
> directories based on if they have modified files within. I don't know 
> if there is a "canonical" way to do this, although one idea would be 
> to return a list of all file status in the directory, e.g. 
> `(up-to-date modified ignored)`.
>
> I started looking through diff-hl. It looks like it has a bunch of 
> neat and useful features, though I admit I was a bit confused by the 
> workflow.
>


--------------22756C2F6450B47F54C776CB
Content-Type: application/x-shellscript;
 name="git-test.sh"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="git-test.sh"

IyEvYmluL2Jhc2gKCnNldCAtdQoKIyMgIHNjcmlwdCBmb3IgbWFraW5nIGEgZ2l0IGRpciB3
aXRoIGFsbCBraW5kcyBvZiBmaWxlcwoKIyMgIHdlIG1ha2UgdHdvIGRpcmVjdG9yeSBzdHJ1
Y3R1cmVzCiMjCiMjICBhIHJlcG8gdGhhdCBoYXMgbW9kaWZpZWQgZmlsZXM6ICBtb2RzLwoj
IwojIyAgICBiYXJlLyAgIGNvbW1vbiBiYXJlIHJlcG8KIyMgICAgcmVwbzEvICBiYXNlIHJl
cG8gZm9yIGVkaXRpbmcKIyMgICAgcmVwbzIvICBhIHJlcG8gd2hlcmUgd2UgbWFrZSBjaGFu
Z2VzIGFuZCBjb21taXQgdGhlbQojIyAgICByZXBvMy8gIGEgcmVwbyB3aGVyZSB3ZSBtYWtl
IGNoYW5nZXMgdGhhdCBhcmUgYWxzbyBpbgojIyAgICAgICAgICAgICAgICAgICAgICB0aGUg
d29ya2luZyB0cmVlIGFuZC9vciBpbmRleAojIwojIyAgaW4gb3RoZXIgd29yZHMsIGxvb2sg
Zm9yIGludGVyZXN0aW5nIHN0YXR1c2VzIGluIG1vZHMvIGFuZAojIyAgcmVwbzIvLCByZXBv
My8KCmVycm9yICgpIHsKICAgIDE+JjIgZWNobyAiZXJyb3I6ICQqIgogICAgZXhpdCAxCn0K
CmVycm9yX2NuICgpIHsKICAgIGVycm9yICJjb3VsZCBub3QgJCoiCn0KCmVycm9yX2NubSAo
KSB7CiAgICBlcnJvciAiY291bGQgbm90OiBtb2RzICQqIgp9CgplcnJvcl9jbmMgKCkgewog
ICAgZXJyb3IgImNvdWxkIG5vdDogY29uZmxpY3RzICQqIgp9CgplcnJvcl9jbmwgKCkgewog
ICAgZXJyb3IgImNvdWxkIG5vdDogbG9ncyAkKiIKfQoKcmFuZG9tX3N0cmluZyAoKSB7CiAg
ICAjIHNoZWxsY2hlY2sgZGlzYWJsZT0yMDAyCiAgICBjYXQgL2Rldi91cmFuZG9tIHwgdHIg
LWRjICdhLXpBLVowLTknIHwgaGVhZCAtYzMyCn0KCmluaXRkaXI9IiQocmVhbHBhdGggIiQo
ZGlybmFtZSAiJHtCQVNIX1NPVVJDRVswXX0iKSIpIgpkaXI9IiRpbml0ZGlyL2dpdC10ZXN0
IgojIyBzZXQgdXAgZGlyZWN0b3JpZXMKcm0gLXJmICIkZGlyIiAmJiBta2RpciAiJGRpciIg
JiYgY2QgIiRkaXIiIHx8IGVycm9yX2NuICJtYWtlICRkaXIiCgoKIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjCiMjIyMgIGRvIG1vZHMKCm1vZHNfZGVsZXRlZF9hcnI9KCkKbWtkaXIgbW9kcyAm
JiBjZCBtb2RzICYmIGdpdCBpbml0IHx8IGVycm9yX2NubSAiZ2l0IGluaXQiCmVjaG8gInVu
bW9kaWZpZWQgJChyYW5kb21fc3RyaW5nKSIgPiB1bm1vZGlmaWVkCmVjaG8gImlnbm9yZWQg
JChyYW5kb21fc3RyaW5nKSIgPiBpZ25vcmVkCmVjaG8gImlnbm9yZWQgJChyYW5kb21fc3Ry
aW5nKSIgPiBpZ25vcmVkLU5jb21taXQsaW5kZXhfSXRyZWUKZWNobyAiaWdub3JlZCAkKHJh
bmRvbV9zdHJpbmcpIiA+IGlnbm9yZWQtSWNvbW1pdCxpbmRleF9OdHJlZQplY2hvICJpZ25v
cmVkX21vZCAkKHJhbmRvbV9zdHJpbmcpIiA+IGlnbm9yZWRfbW9kLTFOY29tbWl0LGluZGV4
XzJJdHJlZQoKZWNobyAkJ2lnbm9yZWRcbmlnbm9yZWQtSWNvbW1pdCxpbmRleF9OdHJlZVxu
JyA+IC5naXRpZ25vcmUKZWNobyAiQSAkKHJhbmRvbV9zdHJpbmcpIiA+IG1vZGlmeS1BY29t
bWl0X0JpbmRleF9DdHJlZQplY2hvICJBICQocmFuZG9tX3N0cmluZykiID4gbW9kaWZ5LUFj
b21taXQsaW5kZXhfQnRyZWUKZWNobyAiQSAkKHJhbmRvbV9zdHJpbmcpIiA+IG1vZGlmeS1B
Y29tbWl0X0JpbmRleCx0cmVlCnN0cmluZ19tb2RpZnlfQWNvbW1pdF9CaW5kZXhfQXRyZWU9
IkEgJChyYW5kb21fc3RyaW5nKSIKZWNobyAiJHN0cmluZ19tb2RpZnlfQWNvbW1pdF9CaW5k
ZXhfQXRyZWUiID4gbW9kaWZ5LUFjb21taXRfQmluZGV4X0F0cmVlCmVjaG8gIkEgJChyYW5k
b21fc3RyaW5nKSIgPiBtb2RpZnktQWNvbW1pdCxpbmRleF9YdHJlZQplY2hvICJBICQocmFu
ZG9tX3N0cmluZykiID4gbW9kaWZ5LUFjb21taXRfWGluZGV4LHRyZWUKZWNobyAiQSAkKHJh
bmRvbV9zdHJpbmcpIiA+IG1vZGlmeS1BY29tbWl0X1hpbmRleF9BdHJlZQplY2hvICJyZW5h
bWUgJChyYW5kb21fc3RyaW5nKSIgPiByZW5hbWUtQWNvbW1pdCxpbmRleF9CdHJlZS1jb21t
aXQKZWNobyAicmVuYW1lICQocmFuZG9tX3N0cmluZykiID4gcmVuYW1lLUFjb21taXRfQmlu
ZGV4LHRyZWUtQQplY2hvICJyZW5hbWUgJChyYW5kb21fc3RyaW5nKSIgPiByZW5hbWUtQWNv
bW1pdF9CaW5kZXhfQXRyZWUtQQplY2hvICJyZW5hbWUgJChyYW5kb21fc3RyaW5nKSIgPiBy
ZW5hbWUtQWNvbW1pdF9CaW5kZXhfQ3RyZWUtQQplY2hvICJyZW5hbWUgJChyYW5kb21fc3Ry
aW5nKSIgPiByZW5hbWUtQWNvbW1pdF9YaW5kZXhfQnRyZWUtQQpnaXQgYWRkIC4gJiYgZ2l0
IGNvbW1pdCAtYSAtbSAiSW5pdCIgfHwgZXJyb3JfY25tICJnaXQgYWRkIGFuZCBjb21taXQi
CgojIyAgaGF2ZSBzb21lIHRoaW5ncyBiZSBkaWZmZXJlbnQgaW4gaW5kZXgKZWNobyAiQSAk
KHJhbmRvbV9zdHJpbmcpIiA+IG1vZGlmeS1YY29tbWl0X0FpbmRleF9YdHJlZQplY2hvICJB
ICQocmFuZG9tX3N0cmluZykiID4gbW9kaWZ5LVhjb21taXRfQWluZGV4LHRyZWUKZWNobyAi
QSAkKHJhbmRvbV9zdHJpbmcpIiA+IG1vZGlmeS1YY29tbWl0X0FpbmRleF9CdHJlZQplY2hv
ICJCICQocmFuZG9tX3N0cmluZykiID4+IG1vZGlmeS1BY29tbWl0X0JpbmRleF9DdHJlZQpl
Y2hvICJCICQocmFuZG9tX3N0cmluZykiID4gbW9kaWZ5LUFjb21taXRfQmluZGV4LHRyZWUK
ZWNobyAiQiAkKHJhbmRvbV9zdHJpbmcpIiA+IG1vZGlmeS1BY29tbWl0X0JpbmRleF9BdHJl
ZQptdiByZW5hbWUtQWNvbW1pdF9CaW5kZXhfQ3RyZWUtQSByZW5hbWUtQWNvbW1pdF9CaW5k
ZXhfQ3RyZWUtQiBcCiAgICB8fCBlcnJvcl9jbm0gIm12IHJlbmFtZS10d2ljZS1pbml0IHJl
bmFtZS10d2ljZS1pbmRleCIKbXYgcmVuYW1lLUFjb21taXRfQmluZGV4LHRyZWUtQSByZW5h
bWUtQWNvbW1pdF9CaW5kZXgsdHJlZS1CIFwKICAgIHx8IGVycm9yX2NubSAicmVuYW1lIgpt
diByZW5hbWUtQWNvbW1pdF9CaW5kZXhfQXRyZWUtQSByZW5hbWUtQWNvbW1pdF9CaW5kZXhf
QXRyZWUtQiBcCiAgICB8fCBlcnJvcl9jbm0gInJlbmFtZSIKZ2l0IGFkZCAuIHx8IGVycm9y
X2NubSAiZ2l0IGFkZCAuIgpnaXQgcm0gbW9kaWZ5LUFjb21taXRfWGluZGV4LHRyZWUKZ2l0
IHJtIC0tY2FjaGVkIG1vZGlmeS1BY29tbWl0X1hpbmRleF9BdHJlZQoKZ2l0IHJtIC0tY2Fj
aGVkIHJlbmFtZS1BY29tbWl0X1hpbmRleF9CdHJlZS1BCm12IHJlbmFtZS1BY29tbWl0X1hp
bmRleF9CdHJlZS1BIHJlbmFtZS1BY29tbWl0X1hpbmRleF9CdHJlZS1CCgptb2RzX2RlbGV0
ZWRfYXJyKz0ocmVuYW1lLUFjb21taXRfQmluZGV4X0N0cmVlLUEgXAogICAgICAgICAgICAg
ICAgICAgICAgIHJlbmFtZS1BY29tbWl0X0JpbmRleCx0cmVlLUEgXAogICAgICAgICAgICAg
ICAgICAgICAgIG1vZGlmeS1BY29tbWl0X1hpbmRleCx0cmVlIFwKICAgICAgICAgICAgICAg
ICAgICAgICByZW5hbWUtQWNvbW1pdF9YaW5kZXhfQnRyZWUtQSkKCiMjICBtb2RpZnkgdGhp
bmdzIGluIHdvcmtpbmcgdHJlZQplY2hvICQnaWdub3JlZFxuaWdub3JlZC1OY29tbWl0LGlu
ZGV4X0l0cmVlXG5pZ25vcmVkX21vZC0xTmNvbW1pdCxpbmRleF8ySXRyZWVcbicgPiAuZ2l0
aWdub3JlCnJtIG1vZGlmeS1BY29tbWl0LGluZGV4X1h0cmVlIHx8IGVycm9yX2NubSAicmVt
b3ZlIHJlbW92ZSIKbXYgcmVuYW1lLUFjb21taXQsaW5kZXhfQnRyZWUtY29tbWl0IHJlbmFt
ZS1BY29tbWl0LGluZGV4X0J0cmVlLXRyZWUgXAogICAgfHwgZXJyb3JfY25tICJyZW5hbWUi
CmVjaG8gIkEgJChyYW5kb21fc3RyaW5nKSIgPiBtb2RpZnktWGNvbW1pdCxpbmRleF9BdHJl
ZQplY2hvICJCICQocmFuZG9tX3N0cmluZykiID4+IG1vZGlmeS1BY29tbWl0LGluZGV4X0J0
cmVlCmVjaG8gIiRzdHJpbmdfbW9kaWZ5X0Fjb21taXRfQmluZGV4X0F0cmVlIiA+IG1vZGlm
eS1BY29tbWl0X0JpbmRleF9BdHJlZQpybSBtb2RpZnktWGNvbW1pdF9BaW5kZXhfWHRyZWUg
fHwgZXJyb3JfY25tICJybSBtb2RpZnktWGNvbW1pdF9BaW5kZXhfWHRyZWUiCmVjaG8gIkMg
JChyYW5kb21fc3RyaW5nKSIgPj4gbW9kaWZ5LUFjb21taXRfQmluZGV4X0N0cmVlCm12IHJl
bmFtZS1BY29tbWl0X0JpbmRleF9DdHJlZS1CIHJlbmFtZV9BY29tbWl0X0JpbmRleF9DdHJl
ZS1DIFwKICAgIHx8IGVycm9yICJtb2RzOiBtdiByZW5hbWUtdHdpY2UtaW5kZXggcmVuYW1l
LXR3aWNlLXRyZWUiCm12IHJlbmFtZS1BY29tbWl0X0JpbmRleF9BdHJlZS1CIHJlbmFtZS1B
Y29tbWl0X0JpbmRleF9BdHJlZS1BIFwKICAgIHx8IGVycm9yX2NubSAicmVuYW1lIgplY2hv
ICJpZ25vcmVkX21vZCAkKHJhbmRvbV9zdHJpbmcpIiA+IGlnbm9yZWRfbW9kLTFOY29tbWl0
LGluZGV4XzJJdHJlZQoKbW9kc19kZWxldGVkX2Fycis9KG1vZGlmeS1BY29tbWl0LGluZGV4
X1h0cmVlIFwKICAgICAgICAgICAgICAgICAgICAgICByZW5hbWUtQWNvbW1pdF9CaW5kZXhf
Q3RyZWUtQiBcCiAgICAgICAgICAgICAgICAgICAgICAgcmVuYW1lLUFjb21taXRfQmluZGV4
X0F0cmVlLUIpCmNkIC4uCgojIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMKIyMjICAgZG8gY29uZmxp
Y3RzCgojIyBzZXQgdXAgYmFyZQpta2RpciBiYXJlICYmIGNkIGJhcmUgJiYgZ2l0IGluaXQg
LS1iYXJlICYmIGNkIC4uIFwKICAgICAgICB8fCBlcnJvcl9jbmMgImdpdCBpbml0IC0tYmFy
ZSIKIyMgc2V0IHVwIHJlcG8gMQpnaXQgY2xvbmUgYmFyZSByZXBvMSAmJiBjZCByZXBvMSB8
fCBlcnJvcl9jbmMgInNldHVwIHJlcG8xIgplY2hvICJpbml0ICQocmFuZG9tX3N0cmluZyki
ID4gY29uZmxpY3QtY29tbWl0CmVjaG8gImluaXQgJChyYW5kb21fc3RyaW5nKSIgPiBjb25m
bGljdC1CY29tbWl0X0NpbmRleCx0cmVlCmVjaG8gImluaXQgJChyYW5kb21fc3RyaW5nKSIg
PiBjb25mbGljdC1CY29tbWl0X0NpbmRleF9EdHJlZQplY2hvICJpbml0ICQocmFuZG9tX3N0
cmluZykiID4gY29uZmxpY3QtaW5kZXgsdHJlZQplY2hvICJpbml0ICQocmFuZG9tX3N0cmlu
ZykiID4gY29uZmxpY3QtQmluZGV4X0N0cmVlCmdpdCBhZGQgLiAmJiBnaXQgY29tbWl0IC1h
IC1tICJJbml0IiB8fCBlcnJvcl9jbmMgImdpdCBhZGQgYW5kIGNvbW1pdCIKZ2l0IHB1c2gg
fHwgZXJyb3JfY25jICJnaXQgcHVzaCIKY2QgLi4gfHwgZXJyb3JfY25jICJjZCAuLiIKCiMj
ICBmaXJzdCBpc3N1ZXMgd2l0aCByZXBvMgoKIyMgY2xvbmUgZnJvbSByZXBvIDEgdG8gcmVw
b3MgMiBhdCB0aGlzIHBvaW50LiBtYWtlIHVubWVyZ2FibGUgY2hhbmdlCmdpdCBjbG9uZSBi
YXJlIHJlcG8yIHx8IGVycm9yX2NuYyAibWFrZSByZXBvcyAyIgojIyBnbyBiYWNrIGFuZCBj
aGFuZ2Ugc29tZSBtb3JlIHRoaW5ncyBpbiByZXBvMQpjZCByZXBvMSB8fCBlcnJvcl9jbmMg
ImNkIHJlcG8xIgplY2hvICJBICQocmFuZG9tX3N0cmluZykiID4gY29uZmxpY3QtY29tbWl0
CmdpdCBhZGQgLiAmJiBnaXQgY29tbWl0IC1hIC1tICJGb3IgcmVwbzIiICYmIGdpdCBwdXNo
IFwKICAgICAgICB8fCBlcnJvcl9jbmMgImdpdCBhZGQgYW5kIGNvbW1pdCByZXBvMSBmb3Ig
cmVwbzIgYW5kIHB1c2giCmNkIC4uIHx8IGVycm9yX2NuYyAiY2QgLi4gdG8gMiIKCiMjIGRl
YWwgd2l0aCByZXBvIDIgbm93LiBqdXN0IGNoYW5nZSBjb25mbGljdC1jb21taXQKY2QgcmVw
bzIgfHwgZXJyb3JfY25jICJzd2l0Y2ggdG8gcmVwbzIiCmVjaG8gIkIgJChyYW5kb21fc3Ry
aW5nKSIgPiBjb25mbGljdC1jb21taXQKZ2l0IGFkZCAuICYmIGdpdCBjb21taXQgLWEgLW0g
IkZvciBtb2RpZnkgcmVtb3RlIiBcCiAgICAgICAgfHwgZXJyb3JfY25jICJnaXQgYWRkIGFu
ZCBjb21taXQgcmVwbzIiCmdpdCBwdWxsCmdpdCBtZXJnZQpjZCAuLiB8fCBlcnJvcl9jbmMg
ImNkIC4uIHRvIDMiCgojIyBjbG9uZSBmcm9tIHJlcG8xIHRvIHJlcG8gMyBhdCB0aGlzIHBv
aW50LiBtYWtlIHVubWVyZ2FibGUgY2hhbmdlCmdpdCBjbG9uZSBiYXJlIHJlcG8zIHx8IGVy
cm9yX2NuYyAibWFrZSByZXBvcyAzIgojIyBnbyBiYWNrIGFuZCBjaGFuZ2Ugc29tZSBtb3Jl
IHRoaW5ncyBpbiByZXBvMQpjZCByZXBvMSB8fCBlcnJvcl9jbmMgImNkIHJlcG8xIgplY2hv
ICJBICQocmFuZG9tX3N0cmluZykiID4gY29uZmxpY3QtQmNvbW1pdF9DaW5kZXgsdHJlZQpl
Y2hvICJBICQocmFuZG9tX3N0cmluZykiID4gY29uZmxpY3QtQmNvbW1pdF9DaW5kZXhfRHRy
ZWUKc3RyaW5nX2NvbmZsaWN0X0Jjb21taXRfQ2luZGV4X0F0cmVlPSJBICQocmFuZG9tX3N0
cmluZykiCmVjaG8gIiRzdHJpbmdfY29uZmxpY3RfQmNvbW1pdF9DaW5kZXhfQXRyZWUiID4g
Y29uZmxpY3QtQmNvbW1pdF9DaW5kZXhfQXRyZWUKZ2l0IGFkZCAuICYmIGdpdCBjb21taXQg
LWEgLW0gIkZvciByZXBvMyIgJiYgZ2l0IHB1c2ggXAogICAgICAgIHx8IGVycm9yX2NuYyAi
Z2l0IGFkZCBhbmQgY29tbWl0IHJlcG8xIGZvciByZXBvMyBhbmQgcHVzaCIKY2QgLi4gfHwg
ZXJyb3JfY25jICJjZCAuLiB0byA0IgoKIyMgZGVhbCB3aXRoIHJlcG8gMyBub3cuCmNkIHJl
cG8zIHx8IGVycm9yX2NuYyAic3dpdGNoIHRvIHJlcG8zIgplY2hvICJCICQocmFuZG9tX3N0
cmluZykiID4gY29uZmxpY3QtQmNvbW1pdF9DaW5kZXgsdHJlZQplY2hvICJCICQocmFuZG9t
X3N0cmluZykiID4gY29uZmxpY3QtQmNvbW1pdF9DaW5kZXhfRHRyZWUKZWNobyAiQiAkKHJh
bmRvbV9zdHJpbmcpIiA+IGNvbmZsaWN0LUJjb21taXRfQ2luZGV4X0F0cmVlCmdpdCBhZGQg
LiAmJiBnaXQgY29tbWl0IC1hIC1tICJGb3IgbW9kaWZ5IHJlbW90ZSIgXAogICAgICAgIHx8
IGVycm9yX2NuYyAiZ2l0IGFkZCBhbmQgY29tbWl0IHJlcG8zIgoKIyMgIGhhdmUgc29tZSB0
aGluZ3MgYmUgZGlmZmVyZW50IGluIGluZGV4CmVjaG8gIkMgJChyYW5kb21fc3RyaW5nKSIg
PiBjb25mbGljdC1CY29tbWl0X0NpbmRleCx0cmVlCmVjaG8gIkMgJChyYW5kb21fc3RyaW5n
KSIgPiBjb25mbGljdC1CY29tbWl0X0NpbmRleF9EdHJlZQplY2hvICJCICQocmFuZG9tX3N0
cmluZykiID4gY29uZmxpY3QtaW5kZXgsdHJlZQplY2hvICJCICQocmFuZG9tX3N0cmluZyki
ID4gY29uZmxpY3QtQmluZGV4X0N0cmVlCmVjaG8gIkMgJChyYW5kb21fc3RyaW5nKSIgPiBj
b25mbGljdC1CY29tbWl0X0NpbmRleF9BdHJlZQpnaXQgYWRkIC4gfHwgZXJyb3JfY25jICJn
aXQgYWRkIC4iCgojIyAgaGF2ZSBzb21lIHRoaW5ncyBiZSBkaWZmZXJlbnQgaW4gdHJlZQpl
Y2hvICJEICQocmFuZG9tX3N0cmluZykiID4gY29uZmxpY3QtQmNvbW1pdF9DaW5kZXhfRHRy
ZWUKZWNobyAiQyAkKHJhbmRvbV9zdHJpbmcpIiA+IGNvbmZsaWN0LUJpbmRleF9DdHJlZQpl
Y2hvICIkc3RyaW5nX2NvbmZsaWN0X0Jjb21taXRfQ2luZGV4X0F0cmVlIiA+IGNvbmZsaWN0
LUJjb21taXRfQ2luZGV4X0F0cmVlCmdpdCBwdWxsCmdpdCBtZXJnZQoKbG9nZGlyPSIke2lu
aXRkaXI6P2luaXRpZGlyIG5vdCBzZXR9L2xvZ3MiCnJtIC1yZiAiJGxvZ2RpciIgJiYgbWtk
aXIgIiRsb2dkaXIiIHx8IGVycm9yX2NubCAicmVtYWtlICRsb2dkaXIiCgpwcmludF9naXRf
c3RhdHVzICgpIHsKICAgIGxvY2FsIHJlcG8gbG9nX3ByZWYgZGVsZXRlZF9hcnIKICAgIHJl
cG89IiQxIgogICAgY2QgIiRkaXIvJHJlcG8iIHx8IGVycm9yX2NubCAiY2hhbmdlIGRpciAk
ZGlyLyRyZXBvIgogICAgbG9nX3ByZWY9IiRsb2dkaXIvJHJlcG8iCiAgICBzZXQgLS0gZ2l0
IHN0YXR1cyAtLXBvcmNlbGFpbiAtLXVudHJhY2tlZC1maWxlcyAtLWlnbm9yZWQKICAgICMg
c2hlbGxjaGVjayBkaXNhYmxlPTIwNjgsMjE1NgogICAgewogICAgICAgICRAIHwgIiRpbml0
ZGlyL2dpdC1zdGF0dXMtc29ydC5zaCIgID4gIiRsb2dfcHJlZi1wbGFpbi5sb2ciIFwKICAg
ICAgICAgICAgfHwgZXJyb3JfY25sICJtYWtlIGxvZyAkbG9nX3ByZWYtcGxhaW4ubG9nIgog
ICAgICAgIGZpbmQgLiAtbWF4ZGVwdGggMSAtbWluZGVwdGggMSAtdHlwZSBmIC1leGVjICRA
ICd7fScgXDsgXAogICAgICAgICAgICB8ICIkaW5pdGRpci9naXQtc3RhdHVzLXNvcnQuc2gi
ID4gIiRsb2dfcHJlZi1maW5kLmxvZyIgXAogICAgICAgICAgICB8fCBlcnJvcl9jbmwgIm1h
a2UgbG9nICRsb2dfcHJlZi1maW5kLmxvZyIKICAgICAgICBmaW5kIC4gLW1heGRlcHRoIDEg
LW1pbmRlcHRoIDEgLXR5cGUgZiAtZXhlYyBcCiAgICAgICAgICAgICBiYXNoIC1jICJlY2hv
ICd7fTonICYmICQqIHt9ICYmIGVjaG8iIFw7IFwKICAgICAgICAgICAgID4gIiRsb2dfcHJl
Zi1maW5kLXdpdGhuYW1lLmxvZyIgXAogICAgICAgICAgICB8fCBlcnJvcl9jbmwgIm1ha2Ug
bG9nICRsb2dfcHJlZi1maW5kLXdpdGhuYW1lLmxvZyIKICAgICAgICAjIyAgYWRkIGRlbGV0
ZWQgZmlsZXMgaWYgcHJlc2VudAogICAgICAgIGlmIFtbIC12ICIke3JlcG99X2RlbGV0ZWRf
YXJyIiBdXTsgdGhlbgogICAgICAgICAgICBkZWNsYXJlIC1uIGRlbGV0ZWRfYXJyPSIke3Jl
cG99X2RlbGV0ZWRfYXJyIgogICAgICAgICAgICBmb3IgZmlsZSBpbiAiJHtkZWxldGVkX2Fy
cltAXX0iOyBkbwogICAgICAgICAgICAgICAgZWNobyAiJGZpbGU6IiA+PiAiJGxvZ19wcmVm
LWRlbGV0ZWQtd2l0aGZpbGVuYW1lLmxvZyIKICAgICAgICAgICAgICAgICRAICIkZmlsZSIg
fCB0ZWUgLWEgIiRsb2dfcHJlZi1kZWxldGVkLXdpdGhmaWxlbmFtZS5sb2ciIFwKICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgPj4gIiRsb2dfcHJlZi1kZWxldGVkLmxvZ34i
CiAgICAgICAgICAgIGRvbmUKICAgICAgICAgICAgIiRpbml0ZGlyL2dpdC1zdGF0dXMtc29y
dC5zaCIgPCAiJGxvZ19wcmVmLWRlbGV0ZWQubG9nfiIgXAogICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICA+ICIkbG9nX3ByZWYtZGVsZXRlZC5sb2ciCiAgICAg
ICAgZmkKICAgIH0KfQoKcHJpbnRfZ2l0X3N0YXR1cyAibW9kcyIKcHJpbnRfZ2l0X3N0YXR1
cyAicmVwbzIiCnByaW50X2dpdF9zdGF0dXMgInJlcG8zIgoKZWNobyAiU3VjY2VzcyIK
--------------22756C2F6450B47F54C776CB
Content-Type: text/x-patch;
 name="0001-Use-git-status-in-vc-git-status.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-Use-git-status-in-vc-git-status.patch"

From ba77e001b719ff289cf0b1d3dcffd647af6d175d Mon Sep 17 00:00:00 2001
From: Jonathan Ganc <jonganc@HIDDEN>
Date: Thu, 30 Mar 2017 23:13:15 -0400
Subject: [PATCH] Use 'git status' in vc-git-status

---
 lisp/vc/vc-git.el | 79 +++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 53 insertions(+), 26 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 1a3f1bf..ce662fb 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -231,34 +231,61 @@ (defun vc-git--state-code (code)
     (?U 'edited)     ;; FIXME
     (?T 'edited)))   ;; FIXME
 
+(defun vc-git--git-status-to-vc-state (code-list)
+  "Convert a list CODE-LIST of two-letter git status strings to a vc status.
+
+Each element of CODE-LIST comes from the first two characters of
+a line returned by 'git status' and should be passed in the order given by 'git status'. Elements that are nil are simply ignored.
+
+Note that this function may destroy and/or alter `code-list'.
+
+\(It is necessary to allow CODE-LIST to be a list because
+sometimes git status returns multiple lines, e.g. for a file that
+is removed from the index but is present in the HEAD and working
+tree.) "
+  (setq code-list (remq nil code-list))
+  (pcase code-list
+    ('nil 'up-to-date)
+    (`(,code)
+     (pcase code
+       ("!!" 'ignored)
+       ("??" 'unregistered)
+       ;; have only seen this with a file that is only present in the
+       ;; index. let us call this `removed'
+       ("AD" 'removed)
+       (_ (cond
+           ((string-match-p "^[ RD]+$" code) 'removed)
+           ((string-match-p "^[ M]+$" code) 'edited)
+           ((string-match-p "^[ A]+$" code) 'added)
+           ((string-match-p "^[ U]+$" code) 'conflict)
+           (t 'edited)))))
+    ;;  I know of two times when git state returns more than one element,
+    ;;  in both cases returning '("D " "??")':
+    ;;  1. when a file is removed from the index but present in the
+    ;;     HEAD and working tree, the CODE-LIST will be 
+    ;;  2. when a file A is renamed to B in the index and then back to A
+    ;;     in the working tree, the CODE-LIST will be '("??" "RD")
+    ;;  In both these instances, `unregistered' is a reasonable response.
+    (`("D " "??") 'unregistered)
+    ;;  In other cases, let us return `edited'
+    (_ 'edited)))
+
 (defun vc-git-state (file)
   "Git-specific version of `vc-state'."
-  ;; FIXME: This can't set 'ignored or 'conflict yet
-  ;; The 'ignored state could be detected with `git ls-files -i -o
-  ;; --exclude-standard` It also can't set 'needs-update or
-  ;; 'needs-merge. The rough equivalent would be that upstream branch
-  ;; for current branch is in fast-forward state i.e. current branch
-  ;; is direct ancestor of corresponding upstream branch, and the file
-  ;; was modified upstream.  But we can't check that without a network
-  ;; operation.
-  ;; This assumes that status is known to be not `unregistered' because
-  ;; we've been successfully dispatched here from `vc-state', that
-  ;; means `vc-git-registered' returned t earlier once.  Bug#11757
-  (let ((diff (vc-git--run-command-string
-               file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))
-    (if (and diff
-             (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0\\(.*\n.\\)?"
-                           diff))
-        (let ((diff-letter (match-string 1 diff)))
-          (if (not (match-beginning 2))
-              ;; Empty diff: file contents is the same as the HEAD
-              ;; revision, but timestamps are different (eg, file
-              ;; was "touch"ed).  Update timestamp in index:
-              (prog1 'up-to-date
-                (vc-git--call nil "add" "--refresh" "--"
-                              (file-relative-name file)))
-            (vc-git--state-code diff-letter)))
-      (if (vc-git--empty-db-p) 'added 'up-to-date))))
+  
+  (save-match-data
+    (let* ((default-directory (file-name-directory (expand-file-name file)))
+           (status
+            (vc-git--run-command-string file "status" "--porcelain" "-z"
+                                        "--untracked-files" "--ignored" "--"))
+           code-list)
+      ;; if this code is adapted to parse git-status for a directory, note
+      ;; that a renamed file takes up two null values and needs to be
+      ;; treated slightly more carefully
+      (while (string-match "^\\(..\\)[^\0]+\0\\(\\(?:a\\|[^a]\\)*\\)$" status)
+        (add-to-list 'code-list (match-string 1 status) t 'ignore)
+        (setq status (match-string 2 status)))
+      (vc-git--git-status-to-vc-state code-list))))
 
 (defun vc-git-working-revision (_file)
   "Git-specific version of `vc-working-revision'."
-- 
2.9.3


--------------22756C2F6450B47F54C776CB--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 23 Mar 2017 02:18:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 22:18:35 2017
Received: from localhost ([127.0.0.1]:39971 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqsKg-0002Pd-VM
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 22:18:35 -0400
Received: from mail-qk0-f194.google.com ([209.85.220.194]:35140)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cqsKf-0002PR-65
 for 26066 <at> debbugs.gnu.org; Wed, 22 Mar 2017 22:18:33 -0400
Received: by mail-qk0-f194.google.com with SMTP id o135so28480938qke.2
 for <26066 <at> debbugs.gnu.org>; Wed, 22 Mar 2017 19:18:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:subject:to:references:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding;
 bh=babLhV8iCh4Ba7QSYoGavZ9oxtyVMDKtoG9ZtoB5PRk=;
 b=vG19Oa86rPUZzOT57POoNX7yIOgl0EBG5sk+jnPZuTJem4dFkExbSj0Ou2cN4iaH3M
 f3aZq31c4ZIAPnIlrsHry95KD//Djkhkk+6VaAsLZKCxo/hh08zyagT1xpJJW/vuK6pk
 swbq4Rv/lmpy7i1RB7Wh8tm+opAPp1TcID8Q5sU0w46dkFCOXvOvk7yPDjUxqYpHsUK/
 9tFvvd6Y/bZqbG0ZpD9+DZp0BVQVWbhI/zZn/SP0QnMaes9gC2MCYZeeEH1zoXIY9RRh
 7/Bvim5zl/VnSSJJi2wlowGii0+7ip3yd1Z/IWj49hI+NRHhG0mPHReCqPGEuK9z0gt7
 Zjqw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:subject:to:references:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=babLhV8iCh4Ba7QSYoGavZ9oxtyVMDKtoG9ZtoB5PRk=;
 b=KFuWukX7WXCSVWj7tqz/HZ46vJ4mbhqGBD5p/ygGAnjYuf8gLTtH1RHdafsam+ug/w
 MrtPiFpBkxwLCJXZihge41pt4gMH7Jf7I9MukcRMJ2hUmwLQsk0DAsnaIWvjCVo8mxqj
 RzaxiYC7IOIwpXeeXPa6oePNDSXYclHBE2L0depXBKKwnWj/jXTPdfiJKQ1Or4+LL/OL
 /+eIo2TRpJvZFzML7PLMyirziFxoCHl/68ccWZBg4HaHvwK3wG/30VKFAtiWPIvNz6xO
 Tjuwig1dIeKMxOWzjGAsejDxNqWckocBaiCmxloLLoNc5PNG6MfahYLR/vBuovMmJ/6I
 icog==
X-Gm-Message-State: AFeK/H1p7x+QWWcXamKVosaI/0cMQjjK6/aG+PX1GGZ7UHZN5hC7XkNXNYNuHG5o4TSSpQ==
X-Received: by 10.55.12.67 with SMTP id 64mr73857qkm.291.1490235507605;
 Wed, 22 Mar 2017 19:18:27 -0700 (PDT)
Received: from [192.168.1.200] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id o91sm2296296qte.42.2017.03.22.19.18.26
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Wed, 22 Mar 2017 19:18:26 -0700 (PDT)
From: Jonathan Ganc <jonganc@HIDDEN>
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
 <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
Message-ID: <a96a4c5f-1bd6-3756-2189-460d76f44b98@HIDDEN>
Date: Wed, 22 Mar 2017 22:18:25 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

Hi,

Thanks for both responses.


>> 3. It would be nice to be able to show mutiple directory trees at 
>> once in Neotree, though this is not as important.
>
> If it's unable to show the non-current projects, how is the bug 
> triggered? default-directory would have to be outside of the project.

I'm not actually sure why it is causing me problems. I just tried using 
Neotree and encountered this problem. I didn't try anything special 
besides opening the window. I'm not sure how/why Neotree sets 
default-directory. I need to look into this.


> The problem might have gone unnoticed until now because file's status 
> is cached, and because it can only be apparent if several projects are 
> opened at the same time.
>
> While the problem is fairly obvious, a proper fix would most likely 
> touch other backends and commands, to the point that the 
> default-directory binding might have to be done inside vc-call-backend.

Yeah, I'm not really sure what the workflow should be; I'm just getting 
started with the vc functions in emacs. One issue, though, is that 
default-directory can only be set for functions that identify a 
filename, because we need to have a directory to set things to. For this 
reason, I don't know that one could generally set default-directory in 
vc-call-backend. It could make sense to set default-directory for 
vc-git--run-command-string (although to get vc-git-state to work, one 
would still need to set it for vc-git--empty-db-p).

It's worth nothing there seems to be inconsistency within vc-git. Some 
commands like vc-git-checkin, vc-git-next-revision, do set 
default-directory to the directory of the input file; other comands like 
vc-git-merge-branch seem to do the opposite and assume the root is 
already given by default-directory.

At the very least, the documentation for vc-git-state should note that 
default-directory needs to be set.

>
> There is a very simple workaround on the caller's side, though: bind 
> default-directory inside the Neotree code, to the respective project 
> root (or just the file's parent directory). That will be necessary 
> anyway for it to work in the released Emacs versions.
>

That may be the best answer. I am not so familiar with the Neotree code 
but it should be doable.

>> 2. I would like to be able to color directories as well as files. I 
>> don't know if that is something that would have a component in 
>> vc-git.el / vc-....el or would go entirely in some package (e.g. 
>> Neotree)
>
> This differs from one version control system to another, but Git 
> doesn't actually track directories. So the notion of "directory 
> status" is poorly defined. But see the previously mentioned 
> diff-hl-dired-mode.
>

You're right, in principle, but atom handles it by coloring directories 
based on if they have modified files within. I don't know if there is a 
"canonical" way to do this, although one idea would be to return a list 
of all file status in the directory, e.g. `(up-to-date modified ignored)`.

I started looking through diff-hl. It looks like it has a bunch of neat 
and useful features, though I admit I was a bit confused by the workflow.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 22 Mar 2017 16:20:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 12:20:18 2017
Received: from localhost ([127.0.0.1]:39630 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqizi-00052H-1K
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 12:20:18 -0400
Received: from mail-wr0-f173.google.com ([209.85.128.173]:34053)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1cqizf-000523-6i
 for 26066 <at> debbugs.gnu.org; Wed, 22 Mar 2017 12:20:15 -0400
Received: by mail-wr0-f173.google.com with SMTP id l37so132470640wrc.1
 for <26066 <at> debbugs.gnu.org>; Wed, 22 Mar 2017 09:20:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=iWIzoPwkauUWIIC3Gb6+cuv5V8oFvS7CUY5ymSoFlBU=;
 b=EiLiBb5JYPRYkNpPWrslEcpjcCC6z2+bm61Y9Qe3F/BAJQpkxtnDnRUGts78b/Vc9V
 a86kgSS51lCTbL9w24xd+8JFdjKeNo/8qd5htB8ip0CDn1Ts8sgH6+FjPEwOFB9PDfBJ
 1dh099IPwP8rqE2PEV7puGGwvOT8Y+NemW7D8fW7o03bB3L5GX6bSkDl1MZl4Mham709
 p5WXxNqDVG+/FvE/WEwuTp1Vu53uIFu9i6z0kBlih1eHvr1WcwkwRQQGZEO1pJnnvivp
 9oEOopHvuN0toLJOe+XaEKm6WztPrT8CGJ8orlCdg7P/ewMzSSSjAKzQJwA9SFlp25lx
 JfmA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=iWIzoPwkauUWIIC3Gb6+cuv5V8oFvS7CUY5ymSoFlBU=;
 b=bDTZXh33tmCoH855U4FbGacFPu4ZTDqhMdWB7rkQAiJzLPyGTOi5oMDsfEyvb9Ww8P
 AlqwjhEQiXsC5EVW29/U8NaZPWTzUI/Xnqekxd+HgHqGw9Z4I0WaKSUMGBF2aoPlq0cf
 fAieTXG7k+auebmshCSPd9FkxGx7DTndbE2CJ4hOA4Becay2ye4yyR2aJhUeIUe4DSC4
 t6MVPKi8BMsjlIYLMP4HlXshLblOkCoVH3mXB23XBKEuG4vGufpnI4h/sMGjDzZL1HE2
 H4HL3XSE3dP3UAL6K06YKRfkC5N4Nv4/oQE9tmYn/2Nt5/B7W2iHpnBR0TWGIXQefjfx
 2AyA==
X-Gm-Message-State: AFeK/H35BCSdDnoC1qfiUmN+GZe3PHZYeWSoknGf7YC/ZqEvYU5/0evJoJAzSW045ZWqHA==
X-Received: by 10.223.134.149 with SMTP id 21mr39679184wrx.1.1490199609271;
 Wed, 22 Mar 2017 09:20:09 -0700 (PDT)
Received: from [192.168.0.133] (static-nbl2-118.cytanet.com.cy.
 [212.31.107.118])
 by smtp.googlemail.com with ESMTPSA id c35sm2381102wra.1.2017.03.22.09.20.05
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Wed, 22 Mar 2017 09:20:07 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Jonathan Ganc <jonganc@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <022c0e0a-e039-24ef-66ff-82bcedbacd93@HIDDEN>
Date: Wed, 22 Mar 2017 18:20:04 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.0
MIME-Version: 1.0
In-Reply-To: <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

On 21.03.2017 18:10, Jonathan Ganc wrote:

> Well, the ideal situation is if could get a listing like the one atom 
> has for projects, where you get a visual view of directories and can see 
> folders with changed files as well as the status of files (orangish 
> means modified, green means new, greyed means ignored):
> 
> http://imgur.com/a/PiiGF
> 
> Actually, emacs has something not so dissimilar in the Neotree package. 
> (Install it and use `(setq neo-vc-integration '(face char))` ). It has a 
> few shortcomings:
> 
> 1. Because of this bug, it was giving me the wrong status for files, 
> i.e. they showed up wrong. That is how I noticed the bug in the first 
> place.

I see, thanks. Neotree does have an optional feature that colors the 
tree leaves according to their VC statuses.

The problem might have gone unnoticed until now because file's status is 
cached, and because it can only be apparent if several projects are 
opened at the same time.

While the problem is fairly obvious, a proper fix would most likely 
touch other backends and commands, to the point that the 
default-directory binding might have to be done inside vc-call-backend.

There is a very simple workaround on the caller's side, though: bind 
default-directory inside the Neotree code, to the respective project 
root (or just the file's parent directory). That will be necessary 
anyway for it to work in the released Emacs versions.

> 2. I would like to be able to color directories as well as files. I 
> don't know if that is something that would have a component in vc-git.el 
> / vc-....el or would go entirely in some package (e.g. Neotree)

This differs from one version control system to another, but Git doesn't 
actually track directories. So the notion of "directory status" is 
poorly defined. But see the previously mentioned diff-hl-dired-mode.

> 3. It would be nice to be able to show mutiple directory trees at once 
> in Neotree, though this is not as important.

If it's unable to show the non-current projects, how is the bug 
triggered? default-directory would have to be outside of the project.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 22 Mar 2017 12:11:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 08:11:23 2017
Received: from localhost ([127.0.0.1]:38732 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqf6p-0005XH-6Y
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2017 08:11:23 -0400
Received: from mout.web.de ([212.227.17.11]:49379)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1cqf6m-0005X2-4D
 for 26066 <at> debbugs.gnu.org; Wed, 22 Mar 2017 08:11:20 -0400
Received: from drachen.dragon ([92.208.182.212]) by smtp.web.de (mrweb103
 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LkhFg-1cIhnT0XnY-00aYRZ; Wed, 22
 Mar 2017 13:10:59 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Jonathan Ganc <jonganc@HIDDEN>
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
 <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
Date: Wed, 22 Mar 2017 13:11:01 +0100
In-Reply-To: <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN> (Jonathan Ganc's
 message of "Tue, 21 Mar 2017 12:10:33 -0400")
Message-ID: <874lyla4ve.fsf@drachen>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:hyBzbhfI5wz/saMp8+l6s995VEExylr8izcNj6OHGpFbkts9OBS
 P4LLR79A3UyzDURNKk73W1ftRWqVV/VzcU+TgxfFgNi4vw5a6UlLev68caM+chYNGclpt5U
 6Un31nwvr1S5nU1VjvB5QxvJBH1VkH27LcP1xDaHJuim/Gj8DHZr6TJFl5fGVLl/rcJt783
 NyZyO/30MAq4nBXQL76TA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:8O73dlkyNCs=:5ukal9qK+mFuI4n0QcP20i
 NUbsjhZMmtt4eH+SlxvLlWGrjuiPjJf60LneL9ujU7nOcFtryOsahUoHgkWYPa4adYLPx7oJy
 cyKKfwDpxELjliaE1HS180Y7sqmrfZhuyuCQLMe5OCeF3r7/O0P/ow7eqabmeqtX7S/Szgrjw
 53QCFXQkg3Y1w8h94fQy9oE7rIBmt5IHX1H+KhO6BdphIen/gLAqp4o4f7YsR1mFc3ayImoWG
 zAmXbJgOc3aUTzsQ7HHSKjwd9diCuE3rsmDrAuuX+bHwckJrsgnZwKPgO6t1jOW/JdpWXCLOd
 r9P1CHVD7gK4p9RR5DA/q25SxBA8+2hW/gPbwvDnxSVMiuPYjyHcBrMiuys4zT9VNnRklu1Tg
 Fbnuwh3cMReGwUjoPkfV0SKjk2z0UbhGyqC4AHrjSg6NBwoNp8jIcSdmOg59phdmPRv3Hn1HA
 q1TTJPoeqN9qlbLR8Ml11FFs9KrrvRmZxRuLfYhc+Ny9uzecm2OWl16LI5edRM3YxPlL/aWxr
 SAMVqrDwZ3/PkbDaeIQ4LF64UE6opHYM2ZqKitMCqlF5h39/mdMfS1MUudxejR1xjR9a3sxzm
 qxeENQrw4ctlVaBjUYkqEMucQEv5GXY5HpwChqmZj7JW2Tc3QCQfr4frQ+phmev/qvK5NbYQH
 kFdSJjZZjIUQxZJg2H10rDDR2eXINOgYulbokDyZ2Nl05V+Y1VvsUMxc0BZKOK44BvWKEFJug
 pF/hvQBwxJf3bFulLMhjw2ObMUsFx6B+ewg/tm8Gk3JyL0iwxebjtY97hdsTC744B6NvuEHdt
 EeTf6h8b7G29bHdpsLH/jqJWYZxKnwqqT33441wzq7t6WkdiGWzSczR+I4cTxATYUCiMQYIHy
 pcZn7nKW6x85C1+RTJMA==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 26066
Cc: npostavs@HIDDEN, 26066 <at> debbugs.gnu.org,
 Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Jonathan Ganc <jonganc@HIDDEN> writes:

> http://imgur.com/a/PiiGF

I didn't quite follow the whole thread, but you might also want to try
`diff-hl-dired-mode' implemented by the diff-hl package in Gnu Elpa.


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 21 Mar 2017 16:10:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 12:10:42 2017
Received: from localhost ([127.0.0.1]:38180 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqMMs-00081J-Ea
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 12:10:42 -0400
Received: from mail-qt0-f169.google.com ([209.85.216.169]:32865)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cqMMq-000817-O3
 for 26066 <at> debbugs.gnu.org; Tue, 21 Mar 2017 12:10:40 -0400
Received: by mail-qt0-f169.google.com with SMTP id i34so134760155qtc.0
 for <26066 <at> debbugs.gnu.org>; Tue, 21 Mar 2017 09:10:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding;
 bh=KnugyW4eUt5jnHfWmD0zzxvgtYMsGU4RYn8O3pd5r5A=;
 b=pNEIPdL6U5zuHMgn+xWJXCzwEZEVAL7jfTkgrLtU2FpizEXC3zzZ/uSWT2GdfqXmbj
 dIKXNtjqEOxWco6td3zE0hpB/RaZV4VaGV57Kboy68VQT6+RLRYqQxQdP4JMKMBcDiNZ
 qEjTLokBJsgff1NtqPfB904/ZIWzgCviyOXZXxw9RSOsk4C6LqTJXXGc/7pFrcxMTZhq
 Ebq37P4MG8oloIDk3eV9UMDjoCZ04O6SDVc13S7U8Zdg0lGBUjV0AfeUIN+g9HM2iDgZ
 8m8ljnqs+YupA+staFe2o2CDa40gUuzlMB0S6uO//IyfBq/k3kxR7+HTH2dUfhKFNZ0g
 1qAQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=KnugyW4eUt5jnHfWmD0zzxvgtYMsGU4RYn8O3pd5r5A=;
 b=WTnDqAQzTl46dEEw+0MeftY8dlOlsWH5dPw0aZNLiHjugydTbZUWYUehfrcIJmKapC
 jWpK22rfJsHUKGFCl0Sj4PFBGh9v2lVPZCesr0WRcb4y0EIgJZa3WXSJPm2mIAY5oA9e
 3kd/7rShN6vBW1JhHOqrdriC74OIvQl1NT9UrSSZFirs7iLKAAo07McxQpRP7//ulcd0
 /dSixZDsjgHw8SrA9FwLCixoNFsC7VQoD7DumoQT7hX2TAjet30xmruiJbihiLjnshuO
 fh2HBfL6waj0QdlM472s2DSbmuvXYHMeTvcJFq28YXwZkX3uKVvRzR9PFOw+E39oXfL+
 AHGA==
X-Gm-Message-State: AFeK/H3UU1faMDofeftsuP1kngFg77g9nJS0ZpASOYLG80tqZ9DXdN5MO/WhTKEt7MIbXA==
X-Received: by 10.200.4.171 with SMTP id s43mr34538138qtg.150.1490112635040;
 Tue, 21 Mar 2017 09:10:35 -0700 (PDT)
Received: from [10.148.5.39] (c-65-96-175-120.hsd1.ma.comcast.net.
 [65.96.175.120])
 by smtp.gmail.com with ESMTPSA id a184sm11689097qkc.68.2017.03.21.09.10.33
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 21 Mar 2017 09:10:34 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
 <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <8530cd03-0158-f198-9b14-ade983e1c7f4@HIDDEN>
Date: Tue, 21 Mar 2017 12:10:33 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

Hi,

Well, the ideal situation is if could get a listing like the one atom 
has for projects, where you get a visual view of directories and can see 
folders with changed files as well as the status of files (orangish 
means modified, green means new, greyed means ignored):

http://imgur.com/a/PiiGF

Actually, emacs has something not so dissimilar in the Neotree package. 
(Install it and use `(setq neo-vc-integration '(face char))` ). It has a 
few shortcomings:

1. Because of this bug, it was giving me the wrong status for files, 
i.e. they showed up wrong. That is how I noticed the bug in the first place.

2. I would like to be able to color directories as well as files. I 
don't know if that is something that would have a component in vc-git.el 
/ vc-....el or would go entirely in some package (e.g. Neotree)

3. It would be nice to be able to show mutiple directory trees at once 
in Neotree, though this is not as important.


The first, big problem is that, because of this bug,


On 03/21/2017 05:19 AM, Dmitry Gutov wrote:
> Hi Jonathan,
>
> On 16.03.2017 04:40, Jonathan Ganc wrote:
>
>> (My ultimate goal is to try to get something like atom's status for 
>> git files into emacs, which is how I noticed the problem to begin with).
>
> Could you expand on what you are trying to do, and how this bug stops 
> you from doing it?





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 21 Mar 2017 09:19:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 05:19:39 2017
Received: from localhost ([127.0.0.1]:37205 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqFx5-0004TH-CP
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 05:19:39 -0400
Received: from mail-wm0-f65.google.com ([74.125.82.65]:33982)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1cqFx3-0004T4-7T
 for 26066 <at> debbugs.gnu.org; Tue, 21 Mar 2017 05:19:37 -0400
Received: by mail-wm0-f65.google.com with SMTP id u132so1770471wmg.1
 for <26066 <at> debbugs.gnu.org>; Tue, 21 Mar 2017 02:19:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=rBg9AtEq4T4fCscrWxECoMnNUGEHjbF2UiJ2Na3qp9g=;
 b=L0wWqS66yWnKgeL15IbGXXAjallketdKXB7fbOlEvlpchmO08/v5G1IsBE53yOOakT
 hw/B1YzDDCzdNXVxVJDODm+s1s4nfyyKHzt+QAoWMnYBFi2Bymz8oRrh4Cnv/bskC/hX
 XpLNq7Ifg0WOdhiGk1SfQvw2+2qOhT1+Hkhl2+pDZJum0BwIZmesfA7eZp66ob51EhxU
 AF5POhlNuxNiBOvbyJ+nKSjNXYKrdwpXDVZAg1XZAgVfwF/bCT1XIoSnnnADkS3mqM24
 B/qZ3S1ZPlR/ZLt3vfaLqCm3cjdB8zJDpPfFxtCX8vRDDW9bj1xX+CW5PEtBrnlDm6V0
 Mb8Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=rBg9AtEq4T4fCscrWxECoMnNUGEHjbF2UiJ2Na3qp9g=;
 b=Tn/0Q+d11pY+1gDZRVfoDYey9R5mRrRuhGndO1r63bWRMueXuJJK2EhRPxlzbLlTxe
 2/lFoCNuswRR9GLAlBWX+1Nl3b6GJ1psYh7YZLQP/netn61uSqT/pj/ZftZqYQpKErYo
 Nf6LSgh5ZUSCTXmFeyDb9h0mMUWKVHv90eGFayfesUnDzRH2Und+PHN0eTQBpIVDKc1M
 R//RHbTfglKBK0VJG/LRfu/2xzTrC5ImIABfZvYvqlDAWgwCZ37SwGQinRdfD2JSPYuP
 KeXinqcBsy+arQ+VpHvgJkq4kRGIuqZJ7hFpmCZDjnyIe2dlS4C9LgImmMeU7cGjI51B
 jn1g==
X-Gm-Message-State: AFeK/H3Pd5vyyvKOEz2eW3m0eKG29Io1NNuhs2DQ/zysuSFcPFs1nufWwwZrlRhyIwo6KA==
X-Received: by 10.28.227.213 with SMTP id a204mr1629937wmh.120.1490087971567; 
 Tue, 21 Mar 2017 02:19:31 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.173.156])
 by smtp.googlemail.com with ESMTPSA id l21sm24086177wrl.59.2017.03.21.02.19.30
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 21 Mar 2017 02:19:31 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Jonathan Ganc <jonganc@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
 <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <4741bddf-9765-0d94-d0cd-b94e3e4914e1@HIDDEN>
Date: Tue, 21 Mar 2017 11:19:29 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.0
MIME-Version: 1.0
In-Reply-To: <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

Hi Jonathan,

On 16.03.2017 04:40, Jonathan Ganc wrote:

> (My ultimate goal is to try to get something like atom's status for git 
> files into emacs, which is how I noticed the problem to begin with).

Could you expand on what you are trying to do, and how this bug stops 
you from doing it?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 18 Mar 2017 02:38:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 17 22:38:16 2017
Received: from localhost ([127.0.0.1]:33120 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cp4G0-0001Vk-ID
	for submit <at> debbugs.gnu.org; Fri, 17 Mar 2017 22:38:16 -0400
Received: from mail-qt0-f193.google.com ([209.85.216.193]:32982)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cp4Fy-0001VV-UP
 for 26066 <at> debbugs.gnu.org; Fri, 17 Mar 2017 22:38:15 -0400
Received: by mail-qt0-f193.google.com with SMTP id r45so11568533qte.0
 for <26066 <at> debbugs.gnu.org>; Fri, 17 Mar 2017 19:38:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to; bh=3z3FIRyDE15d034Msfy2rMsXG+yMwO2grogVkBu9ftg=;
 b=InX4pJC+hu9vukB1WYsGBTa/xoVwXzI1W3wzASAsQ2kHtGHd71fkDTSCrdR+81hXZ6
 j88wtvPqvU9MjmnoGVZdK/mYQarr/fzop01K12grgOVQHLuCVLeE5RaZfVJiglzWUEaW
 QzC3IMwcgg/2/0550Qa8EzdiQjFsKSHHoHmgvyEzmdpWYEl4TvEygco2nbFR3+qBSyEF
 ee0PerPM6X8hShyhjZRX+TVlg5ipq9K4v7dpVlYNnwQUiPXrhlc71HXkAfNVgwkpMVKQ
 mRjhCgV3mDJM20piQDI5Ws+YNAicU9tWYTWXDxLak/vN/IOYGM2fVhyOfa/IVG6q1Tfw
 MGZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to;
 bh=3z3FIRyDE15d034Msfy2rMsXG+yMwO2grogVkBu9ftg=;
 b=opjhNlIqQpnFyg0oP4pnLfOnafIGXPmClYoDS0t6VT9rva/nxx4v/G0if51Ank8zbI
 l7ve8SlPGd2yKOPa8wkf5TVbv67gbzG0m1eOmQvhW5IpFNr9yKeL4O3bvh4wmS/6ui5A
 xj8st533mEeW3gEafe83MJm4mZnhJYL1SRY0NINLTh6bqqglnFxExBAkCIsDFbtQOlEP
 T3KXxGqVk+Bz0sVnDTeUKu1ZTByUrlpndF+HGfIZLyRdkmeZ2Yv2xO1Ei8SfA+XpcNjB
 fL7YHIY8x8fNUtdYRQnbsdcIbb880+4b+chzcHCGkqEwFag1kI2uq2ux1IGjxbbKJmW+
 If7Q==
X-Gm-Message-State: AFeK/H1d7aeb697cSsYxsqmtzbyOn6yaaq22W0s2FsV+ftXeTrpA0dzJfqiGfHUqwdKUMg==
X-Received: by 10.237.60.41 with SMTP id t38mr16460011qte.148.1489804689464;
 Fri, 17 Mar 2017 19:38:09 -0700 (PDT)
Received: from [192.168.1.200] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id x2sm7255201qkc.61.2017.03.17.19.38.08
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 17 Mar 2017 19:38:08 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <0c76ec71-c0d2-42c7-a04e-a4f2520fadf7@HIDDEN>
Date: Fri, 17 Mar 2017 22:38:07 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
Content-Type: multipart/mixed; boundary="------------2C1B4862E5E5BC4E5B7B4625"
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

This is a multi-part message in MIME format.
--------------2C1B4862E5E5BC4E5B7B4625
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi.

I have never submitted an emacs patch before so I don't know if I am 
doing this correctly (or if one of you has already submitted a fix). I 
have attached a patch file.

Later, I will submit the more elegant fix.


On 03/15/2017 08:48 PM, Dmitry Gutov wrote:
> On 16.03.2017 02:42, npostavs@HIDDEN wrote:
>> As an aside, is there a reason that vc-git-status does not use "git
>> status -z --porcelain --ignored"? It seems more natural/straightfoward
>> and it would also deal with ignored and removed files. It could also
>> work with directories, which the current function doesn't.
>
> Like mentioned in a discussion on a different bug, we'll accept a 
> patch like that. You can even reuse some code from 
> `vc-git-conflicted-files`.


--------------2C1B4862E5E5BC4E5B7B4625
Content-Type: text/x-patch;
 name="0001-Fix-default-directory-for-vc-git-Bug-2606.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-Fix-default-directory-for-vc-git-Bug-2606.patch"

From 85a9df8a15b32dc7d884efa74e53c6d20fabaee6 Mon Sep 17 00:00:00 2001
From: Jonathan Ganc <jonganc@HIDDEN>
Date: Fri, 17 Mar 2017 22:35:46 -0400
Subject: [PATCH] Fix default-directory for vc-git (Bug#2606)

---
 lisp/vc/vc-git.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 1a3f1bf..6f20a8d 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -244,8 +244,12 @@ (defun vc-git-state (file)
   ;; This assumes that status is known to be not `unregistered' because
   ;; we've been successfully dispatched here from `vc-state', that
   ;; means `vc-git-registered' returned t earlier once.  Bug#11757
-  (let ((diff (vc-git--run-command-string
-               file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))
+
+  ;; `default-directory' determines where vc-git-... looks for the
+  ;; local git repository
+  (let* ((default-directory (file-name-directory file))
+         (diff (vc-git--run-command-string
+                file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))
     (if (and diff
              (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0\\(.*\n.\\)?"
                            diff))
-- 
2.9.3


--------------2C1B4862E5E5BC4E5B7B4625--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 16 Mar 2017 02:40:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 15 22:40:49 2017
Received: from localhost ([127.0.0.1]:57787 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1coLLN-0003RB-6j
	for submit <at> debbugs.gnu.org; Wed, 15 Mar 2017 22:40:49 -0400
Received: from mail-qk0-f193.google.com ([209.85.220.193]:36773)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1coLLL-0003Qv-4H
 for 26066 <at> debbugs.gnu.org; Wed, 15 Mar 2017 22:40:48 -0400
Received: by mail-qk0-f193.google.com with SMTP id n141so4380523qke.3
 for <26066 <at> debbugs.gnu.org>; Wed, 15 Mar 2017 19:40:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding;
 bh=V/v1h598aea7xqx9ZlU7hhXc3ribJZDVHsO9lDI+GLw=;
 b=Ip56iw11Fmo81NfISYPsKTGHBrohh1mNejE8BVkyvEZITG8PF8A+4pbT2IihlcwA8Z
 pjbfy1HbWtI7EPXD3zZWimYvQAJvtrV4B4q7QzXZ1wwEojH+baNZSjoa28Ty+zWcujzs
 AqodX2BV54xUYaGfWUSZjYbP7NMcK+uMUMIPs7oYcJp4N1hWAdDNAKkIvSCTyyNwi1So
 xG7CcykCKlyoC5iFPxzdaAlluLci+aobwWtWXtAX9P5LeNdKd6o5pc7NrXFiBy7hmEo9
 943wA0zEk5Hm/H777KGArPctOOY9nnKMlPGthJ3kFJuAyeKjXoY54kLM17+dSJ7KksN1
 I1sg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding;
 bh=V/v1h598aea7xqx9ZlU7hhXc3ribJZDVHsO9lDI+GLw=;
 b=kSc3m4MlhaNvC5osm+KFdhPDonAIbKss/NEDnihcnhD4nHbJRhz7Snkr6H7RfizA2U
 50jPk28/jx53MHc7DgoYQGTpwHoml4mSxDdWVMPSQsEZ53oH9acIN4v5Z04wB5TXgMLL
 ruH6ch3hdQpFWMjitCU2l3QtV2ZiktPNLkdKZPVwQKJWBJ7UFRSwqnf0sSKqT/tIfT7A
 UqLySyi/os+i4ZwOhhGUB6jHjH5JMGpYnonGZ1DpIeqYSQOzkvfhDgXxqm31cxMMD+Dg
 DKpOkiHvH6/kbZzP+EB/f5hKRBv7ieub5Cpe3r/zozVeGXOSTrSO1L2E7nCqmbZPZRrQ
 Y8wA==
X-Gm-Message-State: AFeK/H29gnV8i84jYBaJugRBrNRVrdfbmfBYCtShMwaHWoIQJiYpQpk9Aw34DMyModzgXw==
X-Received: by 10.55.64.139 with SMTP id n133mr5758978qka.38.1489632041577;
 Wed, 15 Mar 2017 19:40:41 -0700 (PDT)
Received: from [192.168.1.198] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id j20sm2704389qke.14.2017.03.15.19.40.40
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Wed, 15 Mar 2017 19:40:41 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: Dmitry Gutov <dgutov@HIDDEN>, npostavs@HIDDEN,
 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
 <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@HIDDEN>
Date: Wed, 15 Mar 2017 22:40:40 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
MIME-Version: 1.0
In-Reply-To: <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 26066
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

First of all, I realized that the let binding needs to surround the 
entire vc-git-state function, not just (vc-git--empty-db-p) (because 
vc-git--run-command-string, vc-git--call have the same issue with 
default-directory). E.g., change

(let ((diff (vc-git--run-command-string
                file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))

to

(let* ((default-directory (file-name-directory file))
        (diff (vc-git--run-command-string
              file "diff-index" "-p" "--raw" "-z" "HEAD" "--")))

But yes, I will work on an improved version using git status and try 
incorporate/improve on vc-git-conflicted-files.

(My ultimate goal is to try to get something like atom's status for git 
files into emacs, which is how I noticed the problem to begin with).


On 03/15/2017 08:48 PM, Dmitry Gutov wrote:
> On 16.03.2017 02:42, npostavs@HIDDEN wrote:
>> As an aside, is there a reason that vc-git-status does not use "git
>> status -z --porcelain --ignored"? It seems more natural/straightfoward
>> and it would also deal with ignored and removed files. It could also
>> work with directories, which the current function doesn't.
>
> Like mentioned in a discussion on a different bug, we'll accept a 
> patch like that. You can even reuse some code from 
> `vc-git-conflicted-files`.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 16 Mar 2017 00:48:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 15 20:48:35 2017
Received: from localhost ([127.0.0.1]:57723 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1coJal-0005Xn-8l
	for submit <at> debbugs.gnu.org; Wed, 15 Mar 2017 20:48:35 -0400
Received: from mail-wr0-f196.google.com ([209.85.128.196]:34696)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1coJaj-0005XY-OQ
 for 26066 <at> debbugs.gnu.org; Wed, 15 Mar 2017 20:48:34 -0400
Received: by mail-wr0-f196.google.com with SMTP id u48so3983551wrc.1
 for <26066 <at> debbugs.gnu.org>; Wed, 15 Mar 2017 17:48:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=9O2zeV2K1N0Yycts9AwMYHbX3yE6xiJxgniE3af+BX0=;
 b=r6BIXcHdOyEFez2sVj+8BK1Qzr+13f5R6vFzourUB3Itxl03tP39zFOwbg+j8OfUoN
 JV8wDJEb//bDhBkXQJzt6KG7Rvpn1NJdIWP6wzepa5WTmg48WbO4IpFsbIvFHaINr1Yw
 cCDo8Nw5qTKiJlOl3RRQVQ4wi8BdM2K/c1x36HHfdYDZ4Zq5lkAYHApPHJAtzx54p1TR
 lXZDK0ubq/n7kprOvV9U37EmAlPFjhy5XOZVjyY9pxM8R3FsjneqEIJ6BmNupaoyfpPr
 xAOwgIQG3P+Sl+0FC46lhUrGwMVeQjOIb6SbQPEM1UuDDfAO/D8XdQIM/GEHLwMrawAV
 ff7g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=9O2zeV2K1N0Yycts9AwMYHbX3yE6xiJxgniE3af+BX0=;
 b=smD/AcRlQwjh6y12HIzPWm5l+Yve1/36NnFV4NjFWI5HTt9a9SHwgqN8EbMTaOTWNs
 TXoqoZlX1o+lDuquWCEqoxbp1+C3dZkWa7CO3WvsT5Ucz6ROhSJtWeYdFbq3VdUxzKQv
 Mlb6GZXEsc92C21MzOLdwqXI3P1WCU2ZVdPzrq/pIiPnk2bKu4G3xebpdnc4EfHQrtcq
 tTAJ8YKx6IUuCMcU+K4mU+WDRgzXhW9NjBPTbHcFy98v929390ppdnAxjzGCUyTP2fAf
 i8Pwplp8/emqB3I7X0NGUE0/jmchi3RQ0p/QvXzTw7+TGMYe/8q0Np2CNJC0LhwYaxnI
 yUBA==
X-Gm-Message-State: AFeK/H3LJxDqTLAYOMUJ7TmvHJb0YWbyBjPNSBDMVI5UTyt/42UqVnRVJDUENBtZxuhCkA==
X-Received: by 10.223.164.9 with SMTP id d9mr5466425wra.146.1489625308097;
 Wed, 15 Mar 2017 17:48:28 -0700 (PDT)
Received: from [192.168.1.3] ([185.105.173.156])
 by smtp.googlemail.com with ESMTPSA id r8sm4168875wrb.33.2017.03.15.17.48.26
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Wed, 15 Mar 2017 17:48:27 -0700 (PDT)
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: npostavs@HIDDEN, 26066 <at> debbugs.gnu.org
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87efxy59wx.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@HIDDEN>
Date: Thu, 16 Mar 2017 02:48:24 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.0
MIME-Version: 1.0
In-Reply-To: <87efxy59wx.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 26066
Cc: Jonathan Ganc <jonganc@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

On 16.03.2017 02:42, npostavs@HIDDEN wrote:
> As an aside, is there a reason that vc-git-status does not use "git
> status -z --porcelain --ignored"? It seems more natural/straightfoward
> and it would also deal with ignored and removed files. It could also
> work with directories, which the current function doesn't.

Like mentioned in a discussion on a different bug, we'll accept a patch 
like that. You can even reuse some code from `vc-git-conflicted-files`.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 16 Mar 2017 00:41:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 15 20:41:44 2017
Received: from localhost ([127.0.0.1]:57702 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1coJU7-0005Lg-Tx
	for submit <at> debbugs.gnu.org; Wed, 15 Mar 2017 20:41:44 -0400
Received: from mail-it0-f52.google.com ([209.85.214.52]:37341)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1coJU6-0005LT-Gk
 for 26066 <at> debbugs.gnu.org; Wed, 15 Mar 2017 20:41:42 -0400
Received: by mail-it0-f52.google.com with SMTP id g138so30736890itb.0
 for <26066 <at> debbugs.gnu.org>; Wed, 15 Mar 2017 17:41:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:date:message-id:mime-version;
 bh=gkFzTfWvWnbuYK/4HsI2iRT410Cr6McQj3QWl+PI3aE=;
 b=a9EcluGpL6Jo/N7V5f7ku6ZQrkndqh7/NMM6FHl8QRyVO5FpzMK1ECNAOEjksUqtIH
 6eFkDUxj9CdKAjXtuEhkmjdMJCUij9krkLwI4lKIbPHstXEmZIV2fQQoJZ2C8YPL6Kvm
 qKeLId934pq1JnZjAU7bAU3PlWdR9SqwlrybmioWyosMcKUzv/+U0XJxkDNniicDzpvR
 sMsoxifnWSyYnZkgO0SyRzeE3mmgLUTk+SYtP4aW1NKnRC7R9K+nPggME+Wj0Yig0Ra4
 qUwP9I8c06zbcovF24MfIQu1mWYAGkBzEx9U+xgxITpYKGHWTQvvvFpI7STKm+yXHXQm
 wnCg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:date:message-id
 :mime-version;
 bh=gkFzTfWvWnbuYK/4HsI2iRT410Cr6McQj3QWl+PI3aE=;
 b=W+RFrqPpjkdg0vPCVjv5eomMC+NMH4Js1iVaPjwfT69nhaqCDCgTr0b05NXuZc5cME
 yn0zhpac73efyJDiCkrZAbILIqcvaBk45BvwW8vbYwemIpIplTi5ZCCstaV5XUWOoNyn
 oV3AEg8dENWbYfcH3/V8ddsBKXgG/1sV2luOf9tvOkaOWlPrHy4TmY4MZYVCPBG7IkCl
 mI5A0nSC8SAgj5408JiJ1YvLCeujFY7u2rgIGRdLgpksISvta4d5fHh5YNVY6riAlG4L
 taiyZubWNy/pzBPGXRH25aHAKIVo+wnCzUS9PH3KGO9TxsnF6iEe7I0JL/sfHL/hoc/K
 uYMQ==
X-Gm-Message-State: AFeK/H333d04D7VXhXh8Y44zUddnmW/0NthTbjVp6qtSdU5kH+NzK92/m0mfl92iMAyAlQ==
X-Received: by 10.36.212.129 with SMTP id x123mr7521975itg.103.1489624896791; 
 Wed, 15 Mar 2017 17:41:36 -0700 (PDT)
Received: from zony ([45.2.7.65])
 by smtp.googlemail.com with ESMTPSA id f196sm299226itc.2.2017.03.15.17.41.35
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 15 Mar 2017 17:41:35 -0700 (PDT)
From: npostavs@HIDDEN
To: 26066 <at> debbugs.gnu.org
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
Date: Wed, 15 Mar 2017 20:42:54 -0400
Message-ID: <87efxy59wx.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 26066
Cc: Jonathan Ganc <jonganc@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

--=-=-=
Content-Type: text/plain

[Please use Reply All to keep 26066 <at> debbugs.gnu.org on Cc]


--=-=-=
Content-Type: message/rfc822
Content-Disposition: inline

Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
To: npostavs@HIDDEN
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
 <87y3w855vj.fsf@HIDDEN>
From: Jonathan Ganc <jonganc@HIDDEN>
Message-ID: <6fb773c4-5f05-1965-8fb1-a425cefbfddd@HIDDEN>
Date: Tue, 14 Mar 2017 20:25:57 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
In-Reply-To: <87y3w855vj.fsf@HIDDEN>
X-Spam-Score: -1.1 (-)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
 See http://spamassassin.org/tag/ for more details.
 -1.5 SPF_CHECK_PASS         SPF reports sender host as permitted sender for
                             sender-domain
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail provider
                             (jonganc[at]gmail.com)
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
                             trust
                             [209.85.220.171 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from author's
                             domain
  0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily valid
 -0.1 DKIM_VALID             Message has at least one valid DKIM or DK signature
  0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
                             [209.85.220.171 listed in dnsbl.sorbs.net]
X-Headers-End: 1cnwlQ-0001HR-Bi
MIME-Version: 1.0
Content-Type: text/plain

The actual problem is with the function vc-git--empty-db-p, which acts 
in the directory default-directory (implicitly, through vc-git--call and 
then process-file). Thus, I think replacing (in vc-git-state)
(vc-git--empty-db-p)
with
(let ((default-directory (file-name-directory file)))
   (vc-git--empty-db-p))
should resolve the issue without side effect.

As an aside, is there a reason that vc-git-status does not use "git 
status -z --porcelain --ignored"? It seems more natural/straightfoward 
and it would also deal with ignored and removed files. It could also 
work with directories, which the current function doesn't.

--=-=-=
Content-Type: text/plain



Let-binding default-directory sounds okay.

Regarding 'status -z --porcelain', I think it might not have been
available at the time te code was written.  I'm not sure how far back we
need to maintain compatibility.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.
bug Marked as found in versions 25.2. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.
bug Marked as found in versions 24.5. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.
Severity set to 'minor' from 'normal' Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.
Changed bug title to 'vc-git-status gives wrong result when called from outside repository' from '26.0.50; vc-git-status gives wrong result' Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.

Message received at 26066 <at> debbugs.gnu.org:


Received: (at 26066) by debbugs.gnu.org; 14 Mar 2017 13:44:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 14 09:44:26 2017
Received: from localhost ([127.0.0.1]:55019 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cnmkU-0006kx-1L
	for submit <at> debbugs.gnu.org; Tue, 14 Mar 2017 09:44:26 -0400
Received: from mail-io0-f193.google.com ([209.85.223.193]:33199)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>)
 id 1cnmkS-0006kf-EE; Tue, 14 Mar 2017 09:44:24 -0400
Received: by mail-io0-f193.google.com with SMTP id f84so16431994ioj.0;
 Tue, 14 Mar 2017 06:44:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=ioXi/d8ggGNeZDc/TLsuwjKfbgD0BxpHuyZhLHDlwQg=;
 b=p3bQ+q9KYdJQsE/Z1nAXw5687g1AdkRieO+T3ajENhPEQYCoUL+4MseV6erjZ1rtD+
 0tQbjDhXxH1hKhGSh26JeA1gKNhMEr+YTM7+h+YeGzWqA7CwqrRjHRGckELBq4DSdumW
 sEBRjkOr5Lg1QhfGKxDOb02Jl8IqZRUinHFfSrDjRuHr37e2Pla8h/meII/4pYg2x0IO
 TG36PSkYjzi614D5s0ozcNBYssNZXJVrkw5ywNJ2RnMsPjCjQLgXTZ9Tw2HTqy5LsrT4
 4AkrQU3C4wq4qKnFPUc2YO4bU3rIq1UmVTPkbiREs+uBDYWvVAz5ol5M+INq3+A4XBy3
 20BQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=ioXi/d8ggGNeZDc/TLsuwjKfbgD0BxpHuyZhLHDlwQg=;
 b=d2fMEpjrNDvO+Yb5ZqpD9+jMyAKCYofP8dOI0OXPULELZ78r76d6RLf96tLm8ogSD9
 qhrz6VEoR8nNsJg0/DbDkuev+s6r52goRto5PfaYESAG6KeJg0sNpBrVsc1fgltQoZ9m
 LhZe6V8yWhmq+o+eX8hIXSAUj3n8ePPoIknkA8s7E9o9oDDBoMcXX9cw2PArQZBIbKLJ
 IVyhlrJ+xuOq1c0K0eK5jkObQDwRiygKXm6AdwD4EVl26ZUvFWHDaFTxsYvaAEuU2ZWM
 OPKnzKD9I7AUS9/sUKS7mjceZ5jbTstMBprcE4Mq01S5dmlhFrBzOE294KWlZUdNnNik
 WgKg==
X-Gm-Message-State: AMke39mfK4dP1cCeYND+w/mB2aruYFAQ9mptT4FS2e0uxggvKMWt6FSzf9/oIDEuvvec2A==
X-Received: by 10.107.181.10 with SMTP id e10mr32969292iof.156.1489499058795; 
 Tue, 14 Mar 2017 06:44:18 -0700 (PDT)
Received: from zony ([45.2.7.65])
 by smtp.googlemail.com with ESMTPSA id f196sm215115itc.2.2017.03.14.06.44.17
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 14 Mar 2017 06:44:18 -0700 (PDT)
From: npostavs@HIDDEN
To: Jonathan Ganc <jonganc@HIDDEN>
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
Date: Tue, 14 Mar 2017 09:45:36 -0400
In-Reply-To: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN> (Jonathan Ganc's
 message of "Sat, 11 Mar 2017 21:42:46 -0500")
Message-ID: <87y3w855vj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 26066
Cc: 26066 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

retitle 26066 vc-git-status gives wrong result when called from outside repository
severity 26066 minor
found 26066 24.5
found 26066 25.2
quit

(list 
 (let ((default-directory "/"))
   (require 'vc-git)
   (vc-git-state "/home/npostavs/src/emacs/emacs-master/README"))
 (let ((default-directory "/home/npostavs/src/emacs/emacs-master/"))
   (require 'vc-git)
   (vc-git-state "README"))) ;=> (added up-to-date)

Jonathan Ganc <jonganc@HIDDEN> writes:

> I get this same behavior on emacs 24.5, 25.1. I have some ideas about
> how to fix the problems but I want to make sure this isn't somehow the
> expected behavior.

I doubt this particular behaviour is expected, but it's probably
unexpected that you would call vc-git-status from outside the repo.  If
you can fix things to handle this case without harming the normal case,
that sounds fine to me.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Mar 2017 02:44:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 11 21:44:55 2017
Received: from localhost ([127.0.0.1]:51901 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cmtV9-0002mv-A4
	for submit <at> debbugs.gnu.org; Sat, 11 Mar 2017 21:44:55 -0500
Received: from eggs.gnu.org ([208.118.235.92]:43047)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonganc@HIDDEN>) id 1cmtTM-0002jp-46
 for submit <at> debbugs.gnu.org; Sat, 11 Mar 2017 21:43:04 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <jonganc@HIDDEN>) id 1cmtTF-0001D0-Ar
 for submit <at> debbugs.gnu.org; Sat, 11 Mar 2017 21:42:58 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:52967)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <jonganc@HIDDEN>) id 1cmtTF-0001Cw-7R
 for submit <at> debbugs.gnu.org; Sat, 11 Mar 2017 21:42:57 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34006)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <jonganc@HIDDEN>) id 1cmtTD-0006aW-P8
 for bug-gnu-emacs@HIDDEN; Sat, 11 Mar 2017 21:42:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <jonganc@HIDDEN>) id 1cmtT8-0001CF-SQ
 for bug-gnu-emacs@HIDDEN; Sat, 11 Mar 2017 21:42:55 -0500
Received: from mail-qk0-x22e.google.com ([2607:f8b0:400d:c09::22e]:33599)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <jonganc@HIDDEN>) id 1cmtT8-0001CA-NV
 for bug-gnu-emacs@HIDDEN; Sat, 11 Mar 2017 21:42:50 -0500
Received: by mail-qk0-x22e.google.com with SMTP id y76so203112761qkb.0
 for <bug-gnu-emacs@HIDDEN>; Sat, 11 Mar 2017 18:42:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=to:from:subject:message-id:date:user-agent:mime-version
 :content-transfer-encoding;
 bh=/BeGPDOgZ/XK7q1zUi2/rNkN05j4f6oH8dXvHfOHqcs=;
 b=OADaOfVBQ8kxKtalErh7HHIXZ9AfeF3mXadcppJ5gzTDAjo/GKI5bOn1E5BuoU7CHv
 ZkV0Zr36Z/M4Fe1lRtx5QHtktRQwA5+N00oEIML+w44Nf1Dbr1HT4KMcUOfp0uApj1sv
 WB4fP0l/Nwf/iQFHlPDHbq57/SYN/g5XYAc4xmVQtcchZsru+rsbXX2ShN0iQNVULTDL
 HVjEazRePrmA6BDwHTJg7U/MXDjugwe83QYv+rMkzw2hCUNJ2Tq+LKwhMk1u2KDVyBJL
 De5u62vBd85PQsYw8SBYeMT52ACrh/Qkt5OM8L89y8WIt7g3GHUgp3DvR243ZPMqWOQ6
 LQMA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:to:from:subject:message-id:date:user-agent
 :mime-version:content-transfer-encoding;
 bh=/BeGPDOgZ/XK7q1zUi2/rNkN05j4f6oH8dXvHfOHqcs=;
 b=kobwjPTuhxUjcdkdCNO4Whou/7no0AGEn/64k7nwBBIPDAQTTPce7Q1WSYuMbnZz3B
 GxRKAhnUJK3vzlerFsSoRg0hRqFrUStqDenwROeD3MznexyVlfUUOVJh6O/dXfsTxz0a
 BMB8BeAHPhAV/xH2Qp+Pd6+0/5+dgKW4ZOfgKEXD4lpYVU6Z78+e9Cgtg9CUnNj4gamq
 Szbwx7KPBxdKo3y1Zf9iYm/D86KBlwcCBqmWp31uVlIwcGk2Ro4AqhFLK24JrUFnFl/g
 kPlr1j41cG+LvUx0jJc49siP0r2spuMapvKczFP03tqL9WytXxOH/sBBDSGJcgwl0E1l
 I5qA==
X-Gm-Message-State: AMke39nH9StlCceRZ3YXHovLTTD3Dlrk0bjBxrl3gywiLarm/1gXriFnp9Lw/fzVBYE/aA==
X-Received: by 10.55.17.99 with SMTP id b96mr26439545qkh.74.1489286568610;
 Sat, 11 Mar 2017 18:42:48 -0800 (PST)
Received: from [192.168.1.198] (static-98-118-34-152.bstnma.fios.verizon.net.
 [98.118.34.152])
 by smtp.gmail.com with ESMTPSA id z4sm5525919qkc.22.2017.03.11.18.42.47
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 11 Mar 2017 18:42:48 -0800 (PST)
To: bug-gnu-emacs@HIDDEN
From: Jonathan Ganc <jonganc@HIDDEN>
Subject: 26.0.50; vc-git-status gives wrong result
Message-ID: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@HIDDEN>
Date: Sat, 11 Mar 2017 21:42:46 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.7.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 11 Mar 2017 21:44:55 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)


**To reproduce:**

First, we create a simple git repository in a shell:
   $ mkdir -p ~/Desktop/temp
   $ cd ~/Desktop/temp
   $ git init
   $ echo abc > file.txt
   $ git add . && git commit -a -m "Init"

You can verify that the repository is up to date by running, e.g. 'git 
status'.

Next, we load emacs -Q and run the following:
(progn
   (setq default-directory "/")
   (require 'vc-git)
   (vc-git-state "/home/ganc/Desktop/temp/file.txt"))

The response is `added'. It should be `up-to-date'.

**Notes**


I get this same behavior on emacs 24.5, 25.1. I have some ideas about
how to fix the problems but I want to make sure this isn't somehow the
expected behavior.


In GNU Emacs 26.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.20.9)
  of 2017-03-10 built on lcy01-22
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:    Ubuntu 16.10

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
  'configure --build=x86_64-linux-gnu --prefix=/usr
  '--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
  '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var
  --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu'
  '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
  --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib
  --program-suffix=-snapshot --with-modules=yes --with-x=yes
  --with-x-toolkit=gtk3 --with-xwidgets=yes 'CFLAGS=-g -O2
  -fdebug-prefix-map=/build/emacs-snapshot-rvTCtk/emacs-snapshot-93192-26848af-emacs=. -fstack-protector-strong
  -Wformat -Werror=format-security' 'CPPFLAGS=-Wdate-time
  -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES XWIDGETS LIBSYSTEMD

Important settings:
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
   tooltip-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message puny seq byte-opt subr-x gv
bytecomp byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib
dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript case-table epa-hook jka-cmpr-hook help
simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify dynamic-setting system-font-setting
font-render-setting xwidget-internal move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 96617 5698)
  (symbols 48 20192 1)
  (miscs 40 48 115)
  (strings 32 17613 4552)
  (string-bytes 1 565163)
  (vectors 16 14650)
  (vector-slots 8 482994 4091)
  (floats 8 48 68)
  (intervals 56 241 0)
  (buffers 976 11))





Acknowledgement sent to Jonathan Ganc <jonganc@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#26066; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 24 Apr 2017 01:30:02 UTC

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