diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-12-03 12:45:44 +0000 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2009-02-13 00:01:45 +0200 |
commit | 81aea23e1e92f3073a89d8f755807372fb18c527 (patch) | |
tree | 848b59cd29c50eb9e8fdf6fc9e782fc5e63c5642 /tools | |
parent | 0fd39edf4356ba6c8a72ce61a0f727dd4a89553f (diff) |
Add a script to find the current git branch, and use it in `make upload-branch`
Diffstat (limited to 'tools')
-rw-r--r-- | tools/git-which-branch.sh | 25 |
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 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 |