git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git describe --dirty doesn't work with --work-tree

From
BBlixt <me@blixt.nyc>
Date
Jan 25, 2019, 14:05 UTC
Message-ID
<CAFYJ4vur8KUbvnPaq2McR874K6o5YS6pCkKnihdwN758CKkwng@mail.gmail.com>
In-Reply-To
<CAFYJ4vvGhwxd5wTq-yYeOy6Hq-GpCsTy6=jG-LoHn2mShM4_NQ@mail.gmail.com>

In a script of mine I want to describe HEAD without changing the current directory, so I specify --git-dir and --work-tree. But it appears the --dirty check doesn't consider the --work-tree value.

Here's a simplified example (on macOS 10.14.1):
$ git version
git version 2.20.1
$ mkdir test
$ cd test
$ git init
Initialized empty Git repository in /Users/example/test/.git/
$ touch test
$ git add test
$ git commit -m "initial commit"
[master (root-commit) 9fc4511] initial commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test
$ git describe --all --dirty
heads/master
$ cd ..
$ git --git-dir test/.git --work-tree test describe --all --dirty
heads/master-dirty
Message 1 of 1 in “git describe --dirty doesn't work with --work-tree”
  1. BlixtJan 25, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.