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

[PATCH] GIT-VERSION-GEN: detect dirty tree and mark the version accordingly.

From
Junio C Hamano <junkio@cox.net>
Date
Jan 10, 2006, 02:53 UTC
Message-ID
<7vlkxobxpg.fsf@assigned-by-dhcp.cox.net>

If we are building from a working tree with local modifications, mark the version accordingly.

Deliberately uses '-' to prevent RPM from being built from such a tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * This is a useful precaution and should be safe, so planned to
   go into 1.1.1.
 GIT-VERSION-GEN |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
339b684aa42ac80964ef0d9049445dad7f83848c
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index c878819..cb393b5 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -11,6 +11,14 @@ set)
 	;;
 esac
 
+dirty=$(sh -c 'git-diff-files --name-only HEAD' 2>/dev/null) || dirty=
+case "$dirty" in
+'')
+	;;
+*)
+	VN="$VN-dirty" ;;
+esac
+
 if test -r $GVF
 then
 	VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-- 
1.1.0
Message 1 of 1 in “GIT-VERSION-GEN: detect dirty tree and mark the version accordingly.”
  1. GIT-VERSION-GEN: detect dirty tree and mark the version accordingly.Junio C Hamano, Jan 10, 2006

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.