aboutsummaryrefslogtreecommitdiffstats
path: root/tools/git-which-branch.sh
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-02-01 21:47:58 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-02-01 22:22:39 +0800
commit621bbbb8631f4b149d0478a3423687e4e973b04f (patch)
tree5dc21cc9d4893343c50af7e8f109905ac6ae447e /tools/git-which-branch.sh
parent9503c4aa28b9a4215e3e325a31b500f2c78b712a (diff)
downloadgsoc2013-empathy-621bbbb8631f4b149d0478a3423687e4e973b04f.tar
gsoc2013-empathy-621bbbb8631f4b149d0478a3423687e4e973b04f.tar.gz
gsoc2013-empathy-621bbbb8631f4b149d0478a3423687e4e973b04f.tar.bz2
gsoc2013-empathy-621bbbb8631f4b149d0478a3423687e4e973b04f.tar.lz
gsoc2013-empathy-621bbbb8631f4b149d0478a3423687e4e973b04f.tar.xz
gsoc2013-empathy-621bbbb8631f4b149d0478a3423687e4e973b04f.tar.zst
gsoc2013-empathy-621bbbb8631f4b149d0478a3423687e4e973b04f.zip
Update tools from telepathy-glib
Diffstat (limited to 'tools/git-which-branch.sh')
-rw-r--r--tools/git-which-branch.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/git-which-branch.sh b/tools/git-which-branch.sh
new file mode 100644
index 000000000..b96b5d5e2
--- /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