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: Mon, 30 Aug 2021 05:36:06 +0300 Message-ID: <505a6483-2225-2aef-cec4-f99704384863@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> <6e6060f9-0259-9b12-f925-a1a85c6757c4@yandex.ru> <877dgoutmz.fsf@gnus.org> <2602aeaf-0f02-e744-2b4f-012e73e012e8@yandex.ru> <87y28nbky4.fsf@linkov.net> <87o89ieruy.fsf@mail.linkov.net> <87a6l2d5kd.fsf@gmx.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------05127C9F4482B49A5B86F13A" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14763"; 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: Lars Ingebrigtsen , Noam Postavsky , 39452@debbugs.gnu.org, Wolfgang.Scherer@gmx.de To: Stephen Berman , Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 30 04:37:10 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 1mKXAb-0003ha-Ft for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Aug 2021 04:37:09 +0200 Original-Received: from localhost ([::1]:39980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKXAa-0002Dg-36 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Aug 2021 22:37:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKXAU-0002DY-Bg for bug-gnu-emacs@gnu.org; Sun, 29 Aug 2021 22:37:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46327) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKXAU-0000HU-41 for bug-gnu-emacs@gnu.org; Sun, 29 Aug 2021 22:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mKXAT-0007en-ST for bug-gnu-emacs@gnu.org; Sun, 29 Aug 2021 22:37: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: Mon, 30 Aug 2021 02:37:01 +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.163029097629369 (code B ref 39452); Mon, 30 Aug 2021 02:37:01 +0000 Original-Received: (at 39452) by debbugs.gnu.org; 30 Aug 2021 02:36:16 +0000 Original-Received: from localhost ([127.0.0.1]:57873 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKX9j-0007dd-LW for submit@debbugs.gnu.org; Sun, 29 Aug 2021 22:36:15 -0400 Original-Received: from mail-wm1-f54.google.com ([209.85.128.54]:46057) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKX9i-0007dQ-LK for 39452@debbugs.gnu.org; Sun, 29 Aug 2021 22:36:15 -0400 Original-Received: by mail-wm1-f54.google.com with SMTP id j17-20020a05600c1c1100b002e754875260so8375600wms.4 for <39452@debbugs.gnu.org>; Sun, 29 Aug 2021 19:36:14 -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; bh=BewLBXF3mT/2noCxRawTNoPzZ7idPk8GihLt9sTiETE=; b=ixIPGfxBDbR7V8DSQP0xMCSXK1/o8iEWhzYJggFe/BMJ8S8rOLMjrlyzaEckgu/KQg 1xn4EqG/iNL5CFGgx8c3Qi+jS6djI1Zmbf06O0ar0FrlZ+rDcpLVkTg1Bn1S/m5Igcpl L/Jwhvqm212a9/htdfs7dTirMZvUSaz6wUF3yFh3foZ6ZN3xemglO2u9diCV2mZej2UF 0peJfhC4OpQ0gPgdYcZjrPPnjW67B53T2Y61d8vFToHCZkfT5zrjTaJ+vESUq38iyDf+ EeFc451YmzkggjRYfc7mtDhKvVzOzgBfqRbDTwLmw8YR+6SSSeistHDjyFTxs40Gqbtz TX7Q== 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; bh=BewLBXF3mT/2noCxRawTNoPzZ7idPk8GihLt9sTiETE=; b=VVh9kqqe5H42tUv1VB028dTpJNzDkfU9a7mTSIPmWfesBZtTqqPOE3tIql4UW7zonc 0gi2eHpcMUpAHLaQdQYwDZvOFd0mcoP7yEnZ5gY0rDSLl0I2ZnABs5nsoNzHwArmIUlE teM0bfuhKEbSLchEpmlvs7vJDF08021pu9cGws5QuZxJNGYIFa9zkwxDkN20OV5R2p84 O9eEqXTiuIfO0A3639nNjxzGZyKEuw+MpdM28oJK/VoTAxPd1/o2bTK0b8XgQhfNFhxi dQwRNirK7BBrX+RXSMJAEP8ecIxxd9GoOPF0LlXNu7CUpYUO9QEtRYYUm59tHTT/v/bn /ssQ== X-Gm-Message-State: AOAM533/gnmJzgZV0RYwWMZN4YX26xEvUB4Kij2nsVFt8MuMVzGq+ly6 gBWl5hTnsLrsg39pdI/D+OA= X-Google-Smtp-Source: ABdhPJyO8OG6EIa/PpwScdwthvsgBfhyLnM/WxmSCyioY3MizKidmey+G9dC+IMzv4yEdtQnHFcF/g== X-Received: by 2002:a1c:1b53:: with SMTP id b80mr20256907wmb.133.1630290968838; Sun, 29 Aug 2021 19:36:08 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id y6sm16537401wrm.54.2021.08.29.19.36.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Aug 2021 19:36:08 -0700 (PDT) In-Reply-To: <87a6l2d5kd.fsf@gmx.net> 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:213000 Archived-At: This is a multi-part message in MIME format. --------------05127C9F4482B49A5B86F13A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 27.08.2021 22:57, Stephen Berman wrote: > I just discovered that some code I have that uses vc-print-log-internal > broke after the literal-pathspecs change; specifically, my code passes a > directory name beginning with "~/" to vc-print-log-internal, and this > had worked fine till that change, which broke it, and I found I have to > wrap the directory name in expand-file-name to make the code work again. > Is this expected fallout from that change or was I perhaps misusing > vc-print-log-internal and was just lucky that it had worked before? Here's a patch which restores vc-print-log-internal's behavior without major changes. Check it out (attached). --------------05127C9F4482B49A5B86F13A Content-Type: text/x-patch; charset=UTF-8; name="vc-print-log-internal-restore.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vc-print-log-internal-restore.diff" diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 1cd200cd13..a5431abb40 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -245,7 +245,11 @@ vc-git-update-on-retrieve-tag (defun vc-git--literal-pathspec (file) "Prepend :(literal) path magic to FILE." ;; Good example of file name that needs this: "test[56].xx". - (and file (concat ":(literal)" (file-local-name file)))) + (let ((lname (file-local-name file))) + ;; Expand abbreviated file names. + (when (file-name-absolute-p lname) + (setq lname (expand-file-name lname))) + (and file (concat ":(literal)" lname)))) (defun vc-git--literal-pathspecs (files) "Prepend :(literal) path magic to FILES." diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index b75862e8a5..f0f5809d99 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2055,9 +2055,9 @@ vc-root-diff ;; here, this way the *vc-diff* buffer is setup correctly, so ;; relative file names work. (let ((default-directory rootdir)) - (vc-diff-internal - t (list backend (list (expand-file-name rootdir)) working-revision) nil nil - (called-interactively-p 'interactive)))))) + (vc-diff-internal + t (list backend (list rootdir) working-revision) nil nil + (called-interactively-p 'interactive)))))) ;;;###autoload (defun vc-root-dir () @@ -2603,8 +2603,8 @@ vc-print-root-log (setq backend (vc-responsible-backend rootdir)) (unless backend (error "Directory is not version controlled"))) - (setq default-directory (expand-file-name rootdir)) - (vc-print-log-internal backend (list default-directory) revision revision limit + (setq default-directory rootdir) + (vc-print-log-internal backend (list rootdir) revision revision limit (when with-diff 'with-diff)))) ;;;###autoload --------------05127C9F4482B49A5B86F13A--