From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#26066: 26.0.50; vc-git-status gives wrong result Date: Wed, 12 Apr 2017 02:27:41 +0300 Message-ID: <6ea0d89d-1a24-30fe-dd9a-26a0157a4eae@yandex.ru> References: <9bf82bf1-fefa-ab84-bac1-cf748ae5ccfb@gmail.com> <87efxy59wx.fsf@users.sourceforge.net> <0d87686b-c7d2-deab-ebe4-ab1c8aa4faca@yandex.ru> <29d4a5ae-0ca0-3a86-6b9a-ab616803f39e@gmail.com> <4741bddf-9765-0d94-d0cd-b94e3e4914e1@yandex.ru> <8530cd03-0158-f198-9b14-ade983e1c7f4@gmail.com> <022c0e0a-e039-24ef-66ff-82bcedbacd93@yandex.ru> <505388da-e642-8c98-35c0-261d09ff13e1@yandex.ru> <1a23269d-1ead-1771-1afd-e2c9c5840cb4@gmail.com> <30d8b181-d869-de24-9c86-cc1dc6ec461b@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1491953288 20381 195.159.176.226 (11 Apr 2017 23:28:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 11 Apr 2017 23:28:08 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 To: Jonathan Ganc , npostavs@users.sourceforge.net, 26066@debbugs.gnu.org, Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 12 01:28:05 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 1cy5Ce-0005ED-Pt for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Apr 2017 01:28:04 +0200 Original-Received: from localhost ([::1]:41530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cy5Ck-0004Dw-PV for geb-bug-gnu-emacs@m.gmane.org; Tue, 11 Apr 2017 19:28:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cy5Cf-0004Dq-AW for bug-gnu-emacs@gnu.org; Tue, 11 Apr 2017 19:28:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cy5Cc-0000MP-87 for bug-gnu-emacs@gnu.org; Tue, 11 Apr 2017 19:28:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45244) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cy5Cc-0000MG-4L for bug-gnu-emacs@gnu.org; Tue, 11 Apr 2017 19:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cy5Cb-0000gc-PI for bug-gnu-emacs@gnu.org; Tue, 11 Apr 2017 19:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Apr 2017 23:28:01 +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.14919532722616 (code B ref 26066); Tue, 11 Apr 2017 23:28:01 +0000 Original-Received: (at 26066) by debbugs.gnu.org; 11 Apr 2017 23:27:52 +0000 Original-Received: from localhost ([127.0.0.1]:43443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cy5CR-0000g8-O7 for submit@debbugs.gnu.org; Tue, 11 Apr 2017 19:27:51 -0400 Original-Received: from mail-wm0-f65.google.com ([74.125.82.65]:34408) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cy5CP-0000ft-Nz for 26066@debbugs.gnu.org; Tue, 11 Apr 2017 19:27:50 -0400 Original-Received: by mail-wm0-f65.google.com with SMTP id x75so3214668wma.1 for <26066@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) Original-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) In-Reply-To: <30d8b181-d869-de24-9c86-cc1dc6ec461b@gmail.com> Content-Language: en-US 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:131487 Archived-At: 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.