* [PATCH] Generate btrfs-progs version.h from git too
@ 2008-08-19 18:00 David Woodhouse
0 siblings, 0 replies; only message in thread
From: David Woodhouse @ 2008-08-19 18:00 UTC (permalink / raw)
To: linux-btrfs
This allows version.h to be generated from either git or hg.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
---
version.sh | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/version.sh b/version.sh
index d7988bf..209b7d1 100644
--- a/version.sh
+++ b/version.sh
@@ -8,7 +8,23 @@
v="Btrfs v0.16"
-which hg > /dev/null
+which git &> /dev/null
+if [ $? == 0 -a -d .git ]; then
+ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+ if tag=`git describe --tags 2>/dev/null`; then
+ v="$tag"
+ fi
+
+ # Are there uncommitted changes?
+ git update-index --refresh --unmerged > /dev/null
+ if git diff-index --name-only HEAD | grep -v "^scripts/package" \
+ | read dummy; then
+ v="$v"-dirty
+ fi
+ fi
+fi
+
+which hg &> /dev/null
if [ $? == 0 -a -d .hg ]; then
last=$(hg tags | grep -m1 -o '^v[0-9.]\+')
--
1.5.5.1
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-08-19 18:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-19 18:00 [PATCH] Generate btrfs-progs version.h from git too David Woodhouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox