GNU bug report logs - #39285
28.0.50; vc-dir on gitdir results in error

Previous Next

Package: emacs;

Reported by: "Mark A. Hershberger" <mah <at> everybody.org>

Date: Sat, 25 Jan 2020 21:56:02 UTC

Severity: normal

Tags: fixed

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Robert Pluim <rpluim <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 39285 <at> debbugs.gnu.org, "Mark A. Hershberger" <mah <at> everybody.org>
Subject: bug#39285: 28.0.50; vc-dir on gitdir results in error
Date: Mon, 27 Jan 2020 12:11:28 +0100
>>>>> On Mon, 27 Jan 2020 08:49:20 +0300, Dmitry Gutov <dgutov <at> 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




This bug report was last modified 4 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.