summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2007-11-07 00:53:58 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2007-11-07 00:53:58 +0100
commitccce18563c6ab780b9b27f16fc8ec714fe7ad0ff (patch)
treef9b76e7c156ec7fc084e26aee941129184772d83
parent8b24a0b189ae5b06096f2abefb7571e2da1d7950 (diff)
downloadndim-git-utils-ccce18563c6ab780b9b27f16fc8ec714fe7ad0ff.tar.gz
ndim-git-utils-ccce18563c6ab780b9b27f16fc8ec714fe7ad0ff.tar.xz
ndim-git-utils-ccce18563c6ab780b9b27f16fc8ec714fe7ad0ff.zip
less stupid git tool invocation
-rwxr-xr-xgit-amb/git-amb.in11
1 files changed, 8 insertions, 3 deletions
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="<command> [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"