* bug#39285: 28.0.50; vc-dir on gitdir results in error
@ 2020-01-25 21:55 Mark A. Hershberger
2020-01-27 5:49 ` Dmitry Gutov
0 siblings, 1 reply; 5+ messages in thread
From: Mark A. Hershberger @ 2020-01-25 21:55 UTC (permalink / raw)
To: 39285
While trying projectile's "Browse dirty projects", I hit an error. I
was able to reproduce this error using
(vc-dir "/home/mah/work/code/emacs/.git/")
or any other git dir.
Here is the backtrace:
substring(nil 0 0)
replace-regexp-in-string("^stash@" " " nil)
vc-git-stash-list()
vc-git-dir-extra-headers("/home/mah/work/code/emacs/.git/")
apply(vc-git-dir-extra-headers "/home/mah/work/code/emacs/.git/")
vc-call-backend(Git dir-extra-headers "/home/mah/work/code/emacs/.git/")
vc-dir-headers(Git "/home/mah/work/code/emacs/.git/")
vc-dir-refresh()
vc-dir-mode()
vc-dir("/home/mah/work/code/emacs/.git/")
eval((vc-dir "/home/mah/work/code/emacs/.git/") t)
eval-expression((vc-dir "/home/mah/work/code/emacs/.git/") nil nil 127)
funcall-interactively(eval-expression (vc-dir "/home/mah/work/code/emacs/.git/") nil nil 127)
call-interactively(eval-expression nil nil)
command-execute(eval-expression)
In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
of 2020-01-24 built on silk
Repository revision: ff630b56939541752097e5cc87c3db1de68d4c5f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)
Recent messages:
Entering debugger...
Mark set
next-line: End of buffer [10 times]
Saved text from " substring(nil 0 0)
replace-regexp-in"
Back to top level
Quit
Making completion list...
user-error: Beginning of history; no preceding item
user-error: End of history; no default available [2 times]
Configured using:
'configure --with-modules --with-xwidgets --with-gconf --with-cairo
--with-imagemagick'
Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS GCONF
GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE
HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM
MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2 GMP
Important settings:
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: VC dir
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils thingatpt help-fns radix-tree cl-print debug backtrace
help-mode find-func vc-git diff-mode easymenu easy-mmode vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs vc-dir seq byte-opt gv bytecomp
byte-compile cconv ewoc vc cl-loaddefs cl-lib vc-dispatcher tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
xwidget-internal cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)
Memory information:
((conses 16 63534 5598)
(symbols 48 7744 1)
(strings 32 22875 1739)
(string-bytes 1 697483)
(vectors 16 12421)
(vector-slots 8 155309 11316)
(floats 8 27 73)
(intervals 56 347 0)
(buffers 1000 16))
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#39285: 28.0.50; vc-dir on gitdir results in error
2020-01-25 21:55 bug#39285: 28.0.50; vc-dir on gitdir results in error Mark A. Hershberger
@ 2020-01-27 5:49 ` Dmitry Gutov
2020-01-27 11:11 ` Robert Pluim
2020-09-20 10:14 ` Lars Ingebrigtsen
0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Gutov @ 2020-01-27 5:49 UTC (permalink / raw)
To: Mark A. Hershberger, 39285
Hi there!
On 26.01.2020 0:55, Mark A. Hershberger wrote:
>
> While trying projectile's "Browse dirty projects", I hit an error. I
> was able to reproduce this error using
>
> (vc-dir "/home/mah/work/code/emacs/.git/")
>
> or any other git dir.
What kind of directory is this?
Normally, .git is a utility directory which is not considered part of
the work tree. So most git commands fail inside it.
I suppose vc-git-stash-list could handle this better, but you still
won't get anything better than a misleadingly empty VC-Dir buffer. The
current behavior might even be better in that regard.
This patch would make it shut up, though:
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 61e6c642d1..9b3f3c6545 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1688,12 +1688,14 @@ vc-git-stash-snapshot
(vc-resynch-buffer (vc-git-root default-directory) t t))
(defun vc-git-stash-list ()
- (delete
- ""
- (split-string
- (replace-regexp-in-string
- "^stash@" " " (vc-git--run-command-string nil "stash"
"list"))
- "\n")))
+ (let ((out (vc-git--run-command-string nil "stash" "list")))
+ (when out
+ (delete
+ ""
+ (split-string
+ (replace-regexp-in-string
+ "^stash@" " " out)
+ "\n")))))
(defun vc-git-stash-get-at-point (point)
(save-excursion
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#39285: 28.0.50; vc-dir on gitdir results in error
2020-01-27 5:49 ` Dmitry Gutov
@ 2020-01-27 11:11 ` Robert Pluim
2020-01-27 13:00 ` Dmitry Gutov
2020-09-20 10:14 ` Lars Ingebrigtsen
1 sibling, 1 reply; 5+ messages in thread
From: Robert Pluim @ 2020-01-27 11:11 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 39285, Mark A. Hershberger
>>>>> On Mon, 27 Jan 2020 08:49:20 +0300, Dmitry Gutov <dgutov@yandex.ru> said:
Dmitry> Hi there!
Dmitry> On 26.01.2020 0:55, Mark A. Hershberger wrote:
>> While trying projectile's "Browse dirty projects", I hit an error.
>> I
>> was able to reproduce this error using
>> (vc-dir "/home/mah/work/code/emacs/.git/")
>> or any other git dir.
Dmitry> What kind of directory is this?
Dmitry> Normally, .git is a utility directory which is not considered part of
Dmitry> the work tree. So most git commands fail inside it.
Shouldn't 'vc-dir' have errored out before, since the ".git" directory
is not vc-controlled?
Dmitry> I suppose vc-git-stash-list could handle this better, but you still
Dmitry> won't get anything better than a misleadingly empty VC-Dir buffer. The
Dmitry> current behavior might even be better in that regard.
Dmitry> This patch would make it shut up, though:
Dmitry> diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
Dmitry> index 61e6c642d1..9b3f3c6545 100644
Dmitry> --- a/lisp/vc/vc-git.el
Dmitry> +++ b/lisp/vc/vc-git.el
Dmitry> @@ -1688,12 +1688,14 @@ vc-git-stash-snapshot
Dmitry> (vc-resynch-buffer (vc-git-root default-directory) t t))
Dmitry> (defun vc-git-stash-list ()
Dmitry> - (delete
Dmitry> - ""
Dmitry> - (split-string
Dmitry> - (replace-regexp-in-string
Dmitry> - "^stash@" " " (vc-git--run-command-string nil
Dmitry> "stash" "list"))
Dmitry> - "\n")))
Dmitry> + (let ((out (vc-git--run-command-string nil "stash" "list")))
Dmitry> + (when out
Dmitry> + (delete
Dmitry> + ""
Dmitry> + (split-string
Dmitry> + (replace-regexp-in-string
Dmitry> + "^stash@" " " out)
Dmitry> + "\n")))))
Dmitry> (defun vc-git-stash-get-at-point (point)
Dmitry> (save-excursion
LGTM.
Robert
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#39285: 28.0.50; vc-dir on gitdir results in error
2020-01-27 11:11 ` Robert Pluim
@ 2020-01-27 13:00 ` Dmitry Gutov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Gutov @ 2020-01-27 13:00 UTC (permalink / raw)
To: Robert Pluim; +Cc: 39285, Mark A. Hershberger
On 27.01.2020 14:11, Robert Pluim wrote:
> Shouldn't 'vc-dir' have errored out before, since the ".git" directory
> is not vc-controlled?
Not... really. I mean, we can add that error, but it doesn't error out
a) because we consider any directory inside a working dir to belong to
it, b) because of some defensive programming.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#39285: 28.0.50; vc-dir on gitdir results in error
2020-01-27 5:49 ` Dmitry Gutov
2020-01-27 11:11 ` Robert Pluim
@ 2020-09-20 10:14 ` Lars Ingebrigtsen
1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-20 10:14 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 39285, Mark A. Hershberger
Dmitry Gutov <dgutov@yandex.ru> writes:
> I suppose vc-git-stash-list could handle this better, but you still
> won't get anything better than a misleadingly empty VC-Dir buffer. The
> current behavior might even be better in that regard.
>
> This patch would make it shut up, though:
I think the misleadingly empty directory is better then the cryptic
error, so I applied your patch to Emacs 28.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-20 10:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-25 21:55 bug#39285: 28.0.50; vc-dir on gitdir results in error Mark A. Hershberger
2020-01-27 5:49 ` Dmitry Gutov
2020-01-27 11:11 ` Robert Pluim
2020-01-27 13:00 ` Dmitry Gutov
2020-09-20 10:14 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.