git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 5c7d3c95 broke 026351a
@ 2006-01-26 13:45 Uwe Zeisberger
  2006-01-26 16:39 ` [PATCH] Make GIT-VERSION-GEN tolerate missing git describe command again Uwe Zeisberger
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Zeisberger @ 2006-01-26 13:45 UTC (permalink / raw)
  To: git

Hello,


zeisberger@io:~$ VN=$(nonexistentcmd) || echo lala
bash: nonexistentcmd: command not found
lala

uzeisberger@io:~$ VN=$(nonexistentcmd | sed 's/-/./g') || echo lala
bash: nonexistentcmd: command not found

The reason is (from bash(1)):

	The return status of a pipeline is the exit status of the last
	command, unless the pipefail option is enabled.

and the sed command is fine.

pipefail is not portable, i.e. Solaris' sh doesn't support it.

I'd suggest:

	if VN=$(git-describe --abbrev=4 HEAD 2>/dev/null); then
		VN=$(echo "$VN" | sed 's/-/./g');
	else
		VN=$(cat version) || VN="$DEF_VER";
	fi

This works with Solaris' sh and bash.

Best regards
Uwe

-- 
Uwe Zeisberger

exit vi, lesson V:
o : q ! CTRL-V <CR> <Esc> " d d d @ d

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] Make GIT-VERSION-GEN tolerate missing git describe command again
  2006-01-26 13:45 5c7d3c95 broke 026351a Uwe Zeisberger
@ 2006-01-26 16:39 ` Uwe Zeisberger
  0 siblings, 0 replies; 2+ messages in thread
From: Uwe Zeisberger @ 2006-01-26 16:39 UTC (permalink / raw)
  To: git; +Cc: Uwe Zeisberger

Commit 5c7d3c95 broke that by making the git-describe command part of
a pipe.

Signed-off-by: Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de>

---

 GIT-VERSION-GEN |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

b5763601050151e944cb58b3b0fe6f4aee88b47f
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index e3cd9fa..72201be 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -5,9 +5,11 @@ DEF_VER=v1.1.GIT
 
 # First try git-describe, then see if there is a version file
 # (included in release tarballs), then default
-VN=$(git-describe --abbrev=4 HEAD 2>/dev/null | sed -e 's/-/./g') ||
-VN=$(cat version) ||
-VN="$DEF_VER"
+if VN=$(git-describe --abbrev=4 HEAD 2>/dev/null); then
+	VN=$(echo "$VN" | sed -e 's/-/./g');
+else
+	VN=$(cat version) || VN="$DEF_VER"
+fi
 
 VN=$(expr "$VN" : v*'\(.*\)')
 
-- 
1.1.4-g9acfd

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-26 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-26 13:45 5c7d3c95 broke 026351a Uwe Zeisberger
2006-01-26 16:39 ` [PATCH] Make GIT-VERSION-GEN tolerate missing git describe command again Uwe Zeisberger

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).