File indexing completed on 2024-04-21 05:01:51
0001 #!/bin/sh 0002 # git-which-branch.sh - output the name of the current git branch 0003 # 0004 # The canonical location of this program is the telepathy-spec tools/ 0005 # directory, please synchronize any changes with that copy. 0006 # 0007 # Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/> 0008 # 0009 # Copying and distribution of this file, with or without modification, 0010 # are permitted in any medium without royalty provided the copyright 0011 # notice and this notice are preserved. 0012 0013 default="$1" 0014 if { ref="`git symbolic-ref HEAD 2>/dev/null`"; }; then 0015 echo ${ref#refs/heads/} 0016 exit 0 0017 fi 0018 0019 if test -n "$default"; then 0020 echo "$default" >/dev/null 0021 exit 0 0022 fi 0023 0024 echo "no git branch found" >&2 0025 exit 1