From: Dmitry Gutov <dgutov@yandex.ru>
To: Stephen Berman <stephen.berman@gmx.net>, Juri Linkov <juri@linkov.net>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
Noam Postavsky <npostavs@gmail.com>,
39452@debbugs.gnu.org, Wolfgang.Scherer@gmx.de
Subject: bug#39452: [PATCH] vc-git-state fails for filenames with wildcards
Date: Mon, 30 Aug 2021 05:36:06 +0300 [thread overview]
Message-ID: <505a6483-2225-2aef-cec4-f99704384863@yandex.ru> (raw)
In-Reply-To: <87a6l2d5kd.fsf@gmx.net>
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
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).
[-- Attachment #2: vc-print-log-internal-restore.diff --]
[-- Type: text/x-patch, Size: 1836 bytes --]
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
next prev parent reply other threads:[~2021-08-30 2:36 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 13:59 bug#39452: [PATCH] vc-git-state fails for filenames with wildcards Wolfgang Scherer
2020-02-06 23:00 ` Dmitry Gutov
2020-02-07 7:57 ` Eli Zaretskii
2020-02-07 8:43 ` Dmitry Gutov
2020-02-07 9:26 ` Eli Zaretskii
2020-02-07 11:43 ` Dmitry Gutov
2020-02-07 14:43 ` Noam Postavsky
2020-02-11 23:01 ` Dmitry Gutov
2020-02-12 15:24 ` Noam Postavsky
2021-05-12 16:04 ` Lars Ingebrigtsen
2021-05-17 1:05 ` Dmitry Gutov
2021-07-22 12:42 ` Lars Ingebrigtsen
2021-08-14 0:11 ` Dmitry Gutov
2021-08-14 11:56 ` Lars Ingebrigtsen
2021-08-15 1:25 ` Dmitry Gutov
2021-08-27 6:05 ` Juri Linkov
2021-08-27 12:51 ` Dmitry Gutov
2021-08-27 17:10 ` Juri Linkov
2021-08-27 19:57 ` Stephen Berman
2021-08-28 15:07 ` Lars Ingebrigtsen
2021-08-28 15:44 ` Stephen Berman
2021-08-28 15:48 ` Lars Ingebrigtsen
2021-08-28 16:02 ` Stephen Berman
2021-08-28 22:19 ` Dmitry Gutov
2021-08-30 2:36 ` Dmitry Gutov [this message]
2021-08-30 13:34 ` Stephen Berman
2021-08-30 23:48 ` Dmitry Gutov
2021-08-27 22:47 ` Dmitry Gutov
2021-08-29 0:18 ` Dmitry Gutov
2021-08-29 16:44 ` Juri Linkov
2021-08-29 19:50 ` Dmitry Gutov
2021-08-29 19:57 ` Lars Ingebrigtsen
2021-08-29 20:11 ` Dmitry Gutov
2020-02-13 18:34 ` Wolfgang Scherer
2020-02-13 23:23 ` Dmitry Gutov
2020-02-14 9:37 ` Eli Zaretskii
2020-02-14 13:59 ` Dmitry Gutov
2020-02-14 14:14 ` Eli Zaretskii
2020-02-14 14:40 ` Dmitry Gutov
2020-02-14 15:45 ` Eli Zaretskii
2020-02-14 20:37 ` Dmitry Gutov
2020-09-20 9:54 ` Lars Ingebrigtsen
2020-02-07 17:25 ` Wolfgang Scherer
2020-02-07 22:31 ` Wolfgang Scherer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=505a6483-2225-2aef-cec4-f99704384863@yandex.ru \
--to=dgutov@yandex.ru \
--cc=39452@debbugs.gnu.org \
--cc=Wolfgang.Scherer@gmx.de \
--cc=juri@linkov.net \
--cc=larsi@gnus.org \
--cc=npostavs@gmail.com \
--cc=stephen.berman@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).