From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#39452: [PATCH] vc-git-state fails for filenames with wildcards Date: Sat, 14 Aug 2021 03:11:56 +0300 Message-ID: <6e6060f9-0259-9b12-f925-a1a85c6757c4@yandex.ru> References: <83h802g77h.fsf@gnu.org> <8f427281-510c-30c3-995f-364e22d9c1e2@yandex.ru> <85y2texxso.fsf@gmail.com> <52f47a82-b93e-d9c2-ee94-752b289d4b96@yandex.ru> <85lfp7ygk3.fsf@gmail.com> <87pmxwgcps.fsf@gnus.org> <1cb67253-c43f-caac-ee83-1241edaaeeaa@yandex.ru> <87k0lildtq.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7521"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 Cc: Noam Postavsky , 39452@debbugs.gnu.org, Wolfgang.Scherer@gmx.de To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 14 02:13:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEhIW-0001nm-H0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 Aug 2021 02:13:12 +0200 Original-Received: from localhost ([::1]:49926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEhIU-0000iS-HK for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Aug 2021 20:13:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEhIM-0000i4-Ru for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 20:13:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59940) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mEhIM-0006Yk-L9 for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 20:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mEhIM-0001gg-5j for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 20:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Aug 2021 00:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39452 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 39452-submit@debbugs.gnu.org id=B39452.16288999296425 (code B ref 39452); Sat, 14 Aug 2021 00:13:02 +0000 Original-Received: (at 39452) by debbugs.gnu.org; 14 Aug 2021 00:12:09 +0000 Original-Received: from localhost ([127.0.0.1]:43253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEhHV-0001fZ-HB for submit@debbugs.gnu.org; Fri, 13 Aug 2021 20:12:09 -0400 Original-Received: from mail-wr1-f45.google.com ([209.85.221.45]:43561) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEhHQ-0001f1-J6 for 39452@debbugs.gnu.org; Fri, 13 Aug 2021 20:12:09 -0400 Original-Received: by mail-wr1-f45.google.com with SMTP id z9so15327466wrh.10 for <39452@debbugs.gnu.org>; Fri, 13 Aug 2021 17:12:04 -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=7LEaDG5cpQ+/j4NTQR3N4xWNcnu203pADmMFJ6b5SQE=; b=fPd6hE3vRNznUs4uhtBOERT7CgMgzDiSE4R8+kBKjtEaHxYBbCNjik2iAjdf/QvVM1 r6DedKN0CzObbzoRz6hKrrbykiy4cZISQaCUhM7sZ/eYsMNPwoGCR782VXlhAGkdkSVt s4g7akLwpnbls0mf5VqHi/uigNHykNoPl3//44s0hTAyLPo2DjG3DiBEll2emFnf45Iq U0hJMK3FvUwirQ38stMZBp5csCkQZ0OuUNRB8uN3GViJmE/kQ3xB5Q1qf3jmwZYV/ewx +nSC3nhnQ4k4Z0bYtqb0RwR6VL2JU2lcawe+BFukxkzBAPlMpoElRt55ocxT7Cfl4vAA /T/A== 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=7LEaDG5cpQ+/j4NTQR3N4xWNcnu203pADmMFJ6b5SQE=; b=HdN9DqfNrX7IzDgBvrFEoTkp9u83Ug6AbLsQPoy+MvQzTyXb2zr2ZTLBZKZ43+FdbE t8VxS87Mi02KDuTGwjxACKew3puuxNNEQtvRq9StLte5rJag+n61m58EEssaHQaeZuId QEZq9LwmDYiEz8gx7zo8LL07Q+pJTDeXohtBG+dNRMziBhBxf6NfABaHSaSk1Jtj2+E9 R4z7JnRteqyX5cxjXzoneB+zgvPB/SoyTW+K6qTfIQwg0S1s73u2aO2sIpj2wnyciEKm 0sYBsDaixhH96rNGo64KZXlMKtWiSiMK27+pll1IlVJTLI1F3Z4LdgBtPNLJBSG+f9zb Cd0A== X-Gm-Message-State: AOAM531kxOY1aD423UHRvKnlTHbZs3oPwfO7ToTOMXo4Su5RoW8/xtDs xbagcUsJ0g+ltt9EJ7LqS5k= X-Google-Smtp-Source: ABdhPJyuzFLQW4iKFseenlAz9SowYwJrPJqQsWPjN38y9rtoB7kkhUOJ3SFp1Wnk1qycSgYTs67aBA== X-Received: by 2002:a05:6000:1b87:: with SMTP id r7mr5872654wru.63.1628899918747; Fri, 13 Aug 2021 17:11:58 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id z6sm2772871wmp.1.2021.08.13.17.11.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Aug 2021 17:11:58 -0700 (PDT) In-Reply-To: <87k0lildtq.fsf@gnus.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:211794 Archived-At: On 22.07.2021 15:42, Lars Ingebrigtsen wrote: > Nobody had any opinions, and the "if it's good enough for Magit" > argument is a good one. So I went ahead and applied Dmitry's patch to > Emacs 28, and we'll see whether there's any push back on that... As luck would have it, I have a bit of code (namely project--vc-list-files) that got broken with that change. Because, when EXTRA-IGNORES are present, it constructs some non-literal pathspecs, which naturally fail (get misinterpreted) with GIT_LITERAL_PATHSPECS=1. So we need an escape hatch to turn off this feature, which could take form of a dynamic variable, like in the patch below. Or we could revert to the other approach. What do people think? diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 714edeba5f..824ea55e7b 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -523,6 +523,7 @@ project--vc-list-files (`Git (let ((default-directory (expand-file-name (file-name-as-directory dir))) (args '("-z")) + vc-git-use-literal-pathspecs files) ;; Include unregistered. (setq args (append args diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 143087122f..1082e724ff 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -220,6 +220,9 @@ vc-git-revision-complete-only-branches :type 'boolean :version "28.1") +(defvar vc-git-use-literal-pathspecs t + "Non-nil to interpret all Git pathspecs literally.") + ;; History of Git commands. (defvar vc-git-history nil) @@ -1772,7 +1775,8 @@ vc-git-command (process-environment (append `("GIT_DIR" - "GIT_LITERAL_PATHSPECS=1" + ,@(when vc-git-use-literal-pathspecs + '("GIT_LITERAL_PATHSPECS=1")) ;; Avoid repository locking during background operations ;; (bug#21559). ,@(when revert-buffer-in-progress-p @@ -1807,8 +1811,9 @@ vc-git--call (process-environment (append `("GIT_DIR" - "GIT_LITERAL_PATHSPECS=1" - ;; Avoid repository locking during background operations + ,@(when vc-git-use-literal-pathspecs + '("GIT_LITERAL_PATHSPECS=1")) + ;; Avoid repository locking during background operations ;; (bug#21559). ,@(when revert-buffer-in-progress-p '("GIT_OPTIONAL_LOCKS=0")))