unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ilya Ostapyshyn <ilya.ostapyshyn@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Fix vc-working-revision return nil when default-directory is not inside repo
Date: Sun, 17 May 2020 17:17:29 +0300	[thread overview]
Message-ID: <m2h7weir2e.fsf@ilya-mbp.lan> (raw)
In-Reply-To: <m2o8qmisdo.fsf@gmail.com> (Ilya Ostapyshyn's message of "Sun, 17 May 2020 16:49:07 +0300")

Ilya Ostapyshyn <ilya.ostapyshyn@gmail.com> writes:

> Dmitry Gutov <dgutov@yandex.ru> writes:
>
> Hi Ilya,
>
> On 17.05.2020 14:16, Ilya Ostapyshyn wrote:
>> "vc-git-mode-line-string" (which is called automatically) failed
>> occasionally with an error message (wrong-type-argument arrayp nil) when
>> the default-directory is outside the repository.
>
> Could you describe a full scenario when this can happen?

Despite the complex scenario I described, the issue is not hard to
reproduce.

1. Open a file in a Git repository
2. (vc-working-revision buffer-file-name)
   => working revision hash
3. (cd "/")
4. (vc-file-clearprops buffer-file-name) ;; clear the cached revision in symbol's props
5. (vc-working-revision buffer-file-name)
   => nil

Note, that (vc-working-revision) attempts to use cached value, and if it
is unavailable calls the VC backend to fetch one.



  reply	other threads:[~2020-05-17 14:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 11:16 [PATCH] Fix vc-working-revision return nil when default-directory is not inside repo Ilya Ostapyshyn
2020-05-17 13:01 ` Dmitry Gutov
2020-05-17 13:49   ` Ilya Ostapyshyn
2020-05-17 14:17     ` Ilya Ostapyshyn [this message]
2020-05-18  0:05       ` Dmitry Gutov

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=m2h7weir2e.fsf@ilya-mbp.lan \
    --to=ilya.ostapyshyn@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.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 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).