bug#81625: 31.0.60; vc-git-status can return incorrect status information
Lester Longley via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <CAA30958J+b+Cgtu7_L41SUDzv8sWAGiFtv=DSKM1P-=OGY_XrA@mail.gmail.com> |
Hi Sean, On Tue, Aug 18, 2026 at 7:13 AM Sean Whitton <[email protected]> wrote: > Lester Longley via "Bug reports for GNU Emacs, the Swiss army knife of text editors" [15/Aug 1:33pm -04] wrote: > > ... > > 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. Here's a reproduction recipe (now verified on Emacs 32.0.50 built this morning): [~] cd /tmp; git init 81625; cd 81625 ... [/tmp/81625] touch blat; git add blat; git commit -m New blat ... [/tmp/81625] mkdir blatter; cd blatter; git init dummy; cd - ... [/tmp/81625] echo "blatter/" > .gitignore [/tmp/81625] git status --porcelain --untracked-files --ignored -- blat !! blatter/dummy/ # now observe the bug: opening file "blat" wrongly shows vc-mode "Git!master", versus expected "Git-master" [/tmp/81625] emacs -Q /tmp/81625/blat I.e., it's the presence of a Git repo within an Git-ignored directory, which matches the applicable Git pathspec, which leads to such "!! ..." records from git status. More such repos. result in more corresponding "!! ..." records: [/tmp/81625] mkdir blatter; cd blatter; git init dumdum; cd - ... [/tmp/81625] git status --porcelain --untracked-files --ignored -- blat !! blatter/dumdum/ !! blatter/dummy/ In my original report, this situation was caused by libvterm, which happened to download a repo. in the process of building that module. Regards, Lester