Re: `git describe --dirty` doesn't consider untracked files to be dirty
- From
Aaron Schrab <aaron@schrab.com>
- Date
- Sep 8, 2020, 23:16 UTC
- Message-ID
- <20200908231652.GC1014@pug.qqx.org>
- In-Reply-To
- <xmqqh7s8z0qw.fsf@gitster.c.googlers.com>
At 09:33 -0700 08 Sep 2020, Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
>Ash Holland <ash@sorrel.sh> writes: > >> There seems to be a discrepancy between how `git describe --dirty` is >> documented and how it actually behaves. The documentation describes >> the --dirty flag like this: >> >>> If the working tree has local modification "-dirty" is appended to it. > >Not limited to what "describe" does, whenever we mention "local >modification", we only mean modification to tracked contents, >because by definition we do not detect or track "modifications" to >anything that is not tracked. Untracked paths may have been >modified multiple times, but since they are not even added, we do >not notice nor care.
It's perhaps worth noting that submodules are already considered dirty when untracked files are added:
$ git diff vim/bundle/fugitive
$ echo foo >vim/bundle/fugitive/foo
$ git diff vim/bundle/fugitive
diff --git i/vim/bundle/fugitive w/vim/bundle/fugitive --- i/vim/bundle/fugitive +++ w/vim/bundle/fugitive @@ -1 +1 @@ -Subproject commit caf3b1d5696e8d39a905e48f1e89d8c0c565168c +Subproject commit caf3b1d5696e8d39a905e48f1e89d8c0c565168c-dirty