bug#81625: 31.0.60; vc-git-status can return incorrect status information

Sean Whitton <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Lester Longley via "Bug reports for GNU Emacs, the Swiss army knife of text editors" [15/Aug  1:33pm -04] wrote:
> X-Debbugs-Cc:
> --text follows this line--
>
> My ~/.emacs is tracked in a Git repo.
>
> The issue isn't specifically related to ~/.emacs; that's just how I
> encountered it.
>
> With:
>
>   [~] emacs -Q .emacs
>
> ... I noticed that the `vc-mode' portion of mode-line shows
> "Git!master", where "!" indicates "ignored".
>
> Importantly, my ~/.gitignore contains this pertinent line:
>
>   [~] grep emacs .gitignore
>   .emacs.d/
>
> This incorrect/misleading info. (i.e., `vc-mode' -> "Git!master",
> rather than "Git-master", when the file is current/clean w.r.t. its
> Git status)
> seems to result from the following command constructed by `vc-git-state':
>
>   [~] git status --porcelain -z --untracked-files --ignored -- .emacs
>   !! .emacs.d/elpa/vterm-20260626.1906/build/libvterm-prefix/src/libvterm/^@
>
> This latter path
> (.emacs.d/elpa/vterm-20260626.1906/build/libvterm-prefix/src/libvterm/)
> isn't special in any way that I'm aware of.
>
> In contrast, when ~/.emacs is modified, the "git status" command
> returns the following, and `vc-mode' indicates "Git:master", as
> expected.
>
>   [~] git status --porcelain -z --untracked-files --ignored -- .emacs
>    M .emacs^@!!
> .emacs.d/elpa/vterm-20260626.1906/build/libvterm-prefix/src/libvterm/^@
>
> Or, without "-z", for readability here:
>
>   [~] git status --porcelain --untracked-files --ignored -- .emacs
>    M .emacs
>   !! .emacs.d/elpa/vterm-20260626.1906/build/libvterm-prefix/src/libvterm/
>
> I'm using:
>
>   [~] git --version
>   git version 2.47.3

Please provide commands to create a populate a sample repository that
shows the problem, so that we can isolate it.

-- 
Sean Whitton
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.