From: "Yi Yue" via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 70526@debbugs.gnu.org
Subject: bug#70526: 29.2; package-vc-upgrade failed with error message "File is not under version control"
Date: Tue, 23 Apr 2024 10:51:18 +0900 [thread overview]
Message-ID: <tencent_98C7312BB9CAFF6882CE334EF8EF21703708@qq.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1909 bytes --]
Hi all:
I encountered the following Backtrace information when invoking
`package-vc-upgrade'.
Debugger entered--Lisp error: (error "File is not under version control")
error("File is not under version control")
vc-deduce-fileset-1(t nil nil)
vc-deduce-fileset(t)
vc-pull()
......
After some edebug debugging and reading the source code, I found that
this error occurs if the buffer where `package-vc-upgrade' is called is
not under a git repository. Additionally, if the current buffer of the
command invocation does not correspond to a specific file, then the
command can execute normally.
After reading the implementation of `package-vc-upgrade', I found that it
binds `default-directory' to the package's path. However, the internally
called `vc-pull' function, which uses `vc-deduce-fileset-1', first
utilizes `buffer-file-name' instead of `default-directory' to fetch
version control backend related information, which leads to this error.
In my past usage, I did not encounter this error, probably because I
usually invoked it within a file buffer under a git repository, or used
the command in a buffer provided by `list-packages'. Here is one
solution I used:
(when (eq emacs-major-version 29)
(defun yy/package-vc-upgrade-advice (upfun pkg-desc)
(with-temp-buffer
(funcall upfun pkg-desc)))
(advice-add 'package-vc-upgrade :around 'yy/package-vc-upgrade-advice))
In a minimal environment with emacs -Q, the following steps can
reproduce my issue:
;; a simple package by purcell
(package-vc-install "https://github.com/purcell/unfill")
;; then try to upgrade it in a buffer that buffer-file-name is not nil
;; and the file is not under Git version control system.
M-x package-vc-upgrade unfill RET
;; now the error may occurs
Regards
YI YUE
[-- Attachment #2: Type: text/html, Size: 2458 bytes --]
next reply other threads:[~2024-04-23 1:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 1:51 Yi Yue via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-04-23 8:31 ` bug#70526: 29.2; package-vc-upgrade failed with error message "File is not under version control" Philip Kaludercic
2024-04-23 10:11 ` Yi Yue via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-23 19:35 ` Philip Kaludercic
2024-04-23 21:07 ` Yi Yue via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-24 2:00 ` Yi Yue via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-24 6:19 ` Philip Kaludercic
2024-04-24 7:02 ` Yi Yue via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-24 7:51 ` Philip Kaludercic
2024-04-24 8:09 ` o0o0o���� via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-27 7:28 ` Philip Kaludercic
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=tencent_98C7312BB9CAFF6882CE334EF8EF21703708@qq.com \
--to=bug-gnu-emacs@gnu.org \
--cc=70526@debbugs.gnu.org \
--cc=include_yy@qq.com \
/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).