git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathias Lafeldt <misfire@debugon.org>
To: git@vger.kernel.org
Subject: [PATCH 2/3] GIT-VERSION-GEN: tweak processing of version file
Date: Fri, 22 Oct 2010 13:24:21 +0200	[thread overview]
Message-ID: <4CC17465.9040100@debugon.org> (raw)
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

  parent reply	other threads:[~2010-10-22 11:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1287746107.git.misfire@debugon.org>
2010-10-22 11:24 ` [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty Mathias Lafeldt
2010-10-22 15:11   ` Jonathan Nieder
2010-10-23 12:23     ` Mathias Lafeldt
2010-10-27  7:50       ` Mathias Lafeldt
2010-10-27 14:28         ` Jakub Narebski
2010-10-22 11:24 ` Mathias Lafeldt [this message]
2010-10-22 11:24 ` [PATCH 3/3] GIT-VERSION-GEN: style nitpicks Mathias Lafeldt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CC17465.9040100@debugon.org \
    --to=misfire@debugon.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).