[Telepathy-commits] [telepathy-qt4/master] upload-branch-docs: automatically work out what the branch name is

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Dec 3 05:10:21 PST 2008


git-which-branch.sh was taken from telepathy-spec.
---
 Makefile.am               |    2 +-
 tools/Makefile.am         |    1 +
 tools/git-which-branch.sh |   25 +++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 1 deletions(-)
 create mode 100644 tools/git-which-branch.sh

diff --git a/Makefile.am b/Makefile.am
index c395305..e0171c4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@ check-local::
 
 doc/html: doxygen-doc
 
-BRANCH = misc
+BRANCH = $(shell sh tools/git-which-branch.sh misc | tr -d '\n' | tr -C "[:alnum:]" _)
 UPLOAD_BRANCH_TO = people.freedesktop.org:public_html/telepathy-qt4
 
 upload-branch-docs: doc/html
diff --git a/tools/Makefile.am b/tools/Makefile.am
index e67921f..81c9fdf 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -2,6 +2,7 @@ EXTRA_DIST = \
     check-coding-style.mk \
     check-misc.sh \
     check-whitespace.sh \
+    git-which-branch.sh \
     lcov.am \
     libtpcodegen.py \
     libqt4codegen.py \
diff --git a/tools/git-which-branch.sh b/tools/git-which-branch.sh
new file mode 100644
index 0000000..b96b5d5
--- /dev/null
+++ b/tools/git-which-branch.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+# git-which-branch.sh - output the name of the current git branch
+#
+# The canonical location of this program is the telepathy-spec tools/
+# directory, please synchronize any changes with that copy.
+#
+# Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+
+default="$1"
+if { ref="`git symbolic-ref HEAD 2>/dev/null`"; }; then
+    echo ${ref#refs/heads/}
+    exit 0
+fi
+
+if test -n "$default"; then
+    echo "$default" >/dev/null
+    exit 0
+fi
+
+echo "no git branch found" >&2
+exit 1
-- 
1.5.6.5



More information about the Telepathy-commits mailing list