[Telepathy-commits] [telepathy-spec/master] Add a script to find the current git branch, and use it in `make upload-branch`
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Dec 3 04:45:44 PST 2008
---
Makefile | 2 +-
tools/git-which-branch.sh | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletions(-)
create mode 100644 tools/git-which-branch.sh
diff --git a/Makefile b/Makefile
index 313f487..1b0a7c3 100644
--- a/Makefile
+++ b/Makefile
@@ -138,7 +138,7 @@ dist:
$(TAR) -ztvf "$$distname".tar.gz;\
rm -rf tmp/"$$distname"
-BRANCH = misc
+BRANCH = $(shell sh tools/git-which-branch.sh misc)
UPLOAD_BRANCH_TO = people.freedesktop.org:public_html/telepathy-spec
# Usage: make upload-branch BRANCH=discussion
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