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

Possible kinder GIT-VERSION-GEN?

From
Bill Lear <rael@zopyra.com>
Date
Feb 4, 2008, 20:28 UTC
Message-ID
<18343.30080.67524.3427@lisa.zopyra.com>

I have my home directory under git control, and I have a build directory (not tracked by git) under my home directory into which I untar files and then in which I build things, including git.

When doing this, the version reported always contains the '-dirty' suffix, which I find annoying (and potentially misleading). I traced this to the GIT-VERSION-GEN script, and I "fixed" it by checking if there is a '.git' directory present before invoking git diff-index, something like this:

dirty=$(sh -c 'test -f .git && git diff-index --name-only HEAD' 2>/dev/null) || dirty=
case "$dirty" in
'')
        ;;
*)
        VN="$VN dirty" ;;
esac

If someone of authority here thinks this seems reasonable (or has a better way), I will test this (along with any suggested improvements) with the git repo itself (to ensure it puts '-dirty' when it really should), and submit a patch.

Bill
Next: Junio C Hamano
Message 1 of 3 in “Possible kinder GIT-VERSION-GEN?”
  1. Bill LearFeb 4, 2008
  2. Junio C HamanoFeb 4, 2008
  3. Bill LearFeb 4, 2008

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.