[Telepathy-commits] [telepathy-glib/master] `make upload-branch-docs`: automatically work out the name of the branch
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Dec 3 05:01:57 PST 2008
---
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 a86c664..052c402 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@ _maintainer-upload-release-local: _maintainer-upload-release-check
rsync -rtvzPp --chmod=Dg+s,ug+rwX,o=rX docs/reference/html/ \
telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/doc/telepathy-glib/
-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-glib
upload-branch-docs: all
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 8171000..30b5c26 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -13,6 +13,7 @@ EXTRA_DIST = \
check-misc.sh \
check-whitespace.sh \
doc-generator.xsl \
+ git-which-branch.sh \
glib-client-gen.py \
glib-client-marshaller-gen.py \
glib-errors-enum-body-gen.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