all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 39285@debbugs.gnu.org, "Mark A. Hershberger" <mah@everybody.org>
Subject: bug#39285: 28.0.50; vc-dir on gitdir results in error
Date: Mon, 27 Jan 2020 12:11:28 +0100	[thread overview]
Message-ID: <m2k15d887z.fsf@gmail.com> (raw)
In-Reply-To: <eca2d50b-268f-61e6-4796-f1b28c75dcb1@yandex.ru> (Dmitry Gutov's message of "Mon, 27 Jan 2020 08:49:20 +0300")

>>>>> 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





  reply	other threads:[~2020-01-27 11:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-01-27 13:00     ` Dmitry Gutov
2020-09-20 10:14   ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2k15d887z.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=39285@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=mah@everybody.org \
    /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 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.