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

[PATCH 4/4] Teach GIT-VERSION-GEN about the .git file

From
LHLars Hjemli <hjemli@gmail.com>
Date
Feb 20, 2008, 22:13 UTC
Message-ID
<1203545596-6337-5-git-send-email-hjemli@gmail.com>
In-Reply-To
<1203545596-6337-4-git-send-email-hjemli@gmail.com>

The presence of a .git directory used to be good enough evidence that GIT-VERSION-GEN could use 'git describe' to get a version number. But now .git might as well be a file so the test must be extended to cater for such setups.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
 GIT-VERSION-GEN |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 1ad324e..10fe488 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -11,7 +11,7 @@ LF='
 if test -f version
 then
 	VN=$(cat version) || VN="$DEF_VER"
-elif test -d .git &&
+elif test -d .git -o -f .git &&
 	VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
 	case "$VN" in
 	*$LF*) (exit 1) ;;
-- 
1.5.4.1.188.g3ea1f5
Previous: Lars Hjemli
Message 5 of 5 in “Introducing the .git file”
  1. 0/4 Introducing the .git fileLars Hjemli, Feb 20, 2008
  2. 1/4 Add platform-independent .git "symlink"Lars Hjemli, Feb 20, 2008
  3. 2/4 Teach resolve_gitlink_ref() about the .git fileLars Hjemli, Feb 20, 2008
  4. 3/4 Teach git-submodule.sh about the .git fileLars Hjemli, Feb 20, 2008
  5. 4/4 Teach GIT-VERSION-GEN about the .git fileLars Hjemli, Feb 20, 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.