Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] Generate btrfs-progs version.h from git too
Date: Tue, 19 Aug 2008 19:00:08 +0100	[thread overview]
Message-ID: <1219168808.2988.5.camel@pmac.infradead.org> (raw)

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




                 reply	other threads:[~2008-08-19 18:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1219168808.2988.5.camel@pmac.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=linux-btrfs@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