From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jonathan Ganc Newsgroups: gmane.emacs.bugs Subject: bug#26066: 26.0.50; vc-git-status gives wrong result Date: Fri, 17 Mar 2017 22:38:07 -0400 Message-ID: <0c76ec71-c0d2-42c7-a04e-a4f2520fadf7@gmail.com> References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@gmail.com> <87efxy59wx.fsf@users.sourceforge.net> <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2C1B4862E5E5BC4E5B7B4625" X-Trace: blaine.gmane.org 1489804761 24626 195.159.176.226 (18 Mar 2017 02:39:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Mar 2017 02:39:21 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 To: Dmitry Gutov , npostavs@users.sourceforge.net, 26066@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 18 03:39:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cp4Gr-00051l-9X for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Mar 2017 03:39:09 +0100 Original-Received: from localhost ([::1]:51658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cp4Gv-0003i8-Hx for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Mar 2017 22:39:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cp4Gp-0003hr-GC for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2017 22:39:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cp4Gk-00015W-I6 for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2017 22:39:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34921) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cp4Gk-00015Q-EO for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2017 22:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cp4Gk-0001X5-9g for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2017 22:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jonathan Ganc Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Mar 2017 02:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26066 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26066-submit@debbugs.gnu.org id=B26066.14898046965817 (code B ref 26066); Sat, 18 Mar 2017 02:39:02 +0000 Original-Received: (at 26066) by debbugs.gnu.org; 18 Mar 2017 02:38:16 +0000 Original-Received: from localhost ([127.0.0.1]:33120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cp4G0-0001Vk-ID for submit@debbugs.gnu.org; Fri, 17 Mar 2017 22:38:16 -0400 Original-Received: from mail-qt0-f193.google.com ([209.85.216.193]:32982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cp4Fy-0001VV-UP for 26066@debbugs.gnu.org; Fri, 17 Mar 2017 22:38:15 -0400 Original-Received: by mail-qt0-f193.google.com with SMTP id r45so11568533qte.0 for <26066@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) Original-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) In-Reply-To: <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@yandex.ru> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:130686 Archived-At: 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@users.sourceforge.net 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 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--