[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix vc-working-revision return nil when default-directory is
From: |
Ilya Ostapyshyn |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (darwin) |
Ilya Ostapyshyn <address@hidden> writes:
> Dmitry Gutov <address@hidden> 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.