From ccce18563c6ab780b9b27f16fc8ec714fe7ad0ff Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 7 Nov 2007 00:53:58 +0100 Subject: less stupid git tool invocation --- git-amb/git-amb.in | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'git-amb') diff --git a/git-amb/git-amb.in b/git-amb/git-amb.in index 472324e..78d81d8 100755 --- a/git-amb/git-amb.in +++ b/git-amb/git-amb.in @@ -24,6 +24,8 @@ # - git 1.5.3.4 unset CDPATH +SED="${SED-sed}" + if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`" then :; else @@ -65,6 +67,7 @@ case "$1" in ;; esac +SUBDIRECTORY_OK="yes" USAGE=" [params...]" LONG_USAGE="\ @@ -105,13 +108,15 @@ amb_init() { # Equivalent bzr code: # bzr log -r -1.. | sed -n 's/^branch nick: //p' if test "x$1" = "x"; then - git_branch="$(git branch | sed -n 's/^* //p')" - elif git branch | sed 's/^[ *] //' | grep "$1" > /dev/null; then + # determine currently checked out branch + git_branch="$(git-symbolic-ref HEAD | $SED -n 's|^refs/heads/||p')" + elif git-rev-parse "$1" > /dev/null 2>&1; then + # $1 is valid branch: use it git_branch="${1}" else die "Invalid branch \"$1\" given." fi - test "x.git" = "x$(basename "$GIT_DIR")" || die "GIT_DIR=$GIT_DIR is not foo/.git" + test "x$(git-rev-parse --is-inside-work-tree 2> /dev/null)" = "xtrue" top_srcdir="$(cd_to_toplevel && pwd)" tmp="$(git-config amb.builddir)" || tmp="$GIT_DIR/amb/build" -- cgit