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

[PATCH 2/3] GIT-VERSION-GEN: tweak processing of version file

From
Mathias Lafeldt <misfire@debugon.org>
Date
Oct 22, 2010, 11:24 UTC
Message-ID
<4CC17465.9040100@debugon.org>
In-Reply-To
<cover.1287746107.git.misfire@debugon.org>
- check for version file with "test -r"
- read version file using shell builtin "read" rather than "cat"
Signed-off-by: Mathias Lafeldt <misfire@debugon.org>
---
 GIT-VERSION-GEN |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 73d5cf9..427d5d6 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -8,9 +8,9 @@ LF='
 
 # First see if there is a version file (included in release tarballs),
 # then try git-describe, then default.
-if test -f version
+if test -r version
 then
-	VN=$(cat version) || VN="$DEF_VER"
+	read VN 2>/dev/null < version || VN="$DEF_VER"
 elif test -d .git -o -f .git &&
 	VN=$(git describe --match "v[0-9]*" --abbrev=4 --dirty 2>/dev/null) &&
 	case "$VN" in
-- 
1.7.3.2
Previous: Jakub NarebskiNext: Mathias Lafeldt
Message 6 of 7 in “GIT-VERSION-GEN: make use of git describe --dirty”
  1. 1/3 GIT-VERSION-GEN: make use of git describe --dirtyMathias Lafeldt, Oct 22, 2010
  2. Jonathan NiederOct 22, 2010
  3. Mathias LafeldtOct 23, 2010
  4. Mathias LafeldtOct 27, 2010
  5. Jakub NarebskiOct 27, 2010
  6. 2/3 GIT-VERSION-GEN: tweak processing of version fileMathias Lafeldt, Oct 22, 2010
  7. 3/3 GIT-VERSION-GEN: style nitpicksMathias Lafeldt, Oct 22, 2010

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.