Code

pull, rebase: simplify to use die()
authorStephen Boyd <bebarino@gmail.com>
Sun, 14 Jun 2009 23:08:56 +0000 (16:08 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Jun 2009 04:14:10 +0000 (21:14 -0700)
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-pull.sh
git-rebase.sh

index 35261539ab80ffa46fef945dce1a82c5636c1b49..cab367ada009659da23774ec303119af3d972038 100755 (executable)
@@ -176,13 +176,11 @@ case "$merge_head" in
 ?*' '?*)
        if test -z "$orig_head"
        then
-               echo >&2 "Cannot merge multiple branches into empty head"
-               exit 1
+               die "Cannot merge multiple branches into empty head"
        fi
        if test true = "$rebase"
        then
-               echo >&2 "Cannot rebase onto multiple branches"
-               exit 1
+               die "Cannot rebase onto multiple branches"
        fi
        ;;
 esac
index b83fd3f970161d9ca8a4212a0b335f784fc3ff84..334629fc97c0d06e9c9cfda058bdd999810f9d55 100755 (executable)
@@ -168,10 +168,8 @@ run_pre_rebase_hook () {
        if test -z "$OK_TO_SKIP_PRE_REBASE" &&
           test -x "$GIT_DIR/hooks/pre-rebase"
        then
-               "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
-                       echo >&2 "The pre-rebase hook refused to rebase."
-                       exit 1
-               }
+               "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} ||
+               die "The pre-rebase hook refused to rebase."
        fi
 }
 
@@ -359,8 +357,7 @@ fi
 
 # The tree must be really really clean.
 if ! git update-index --ignore-submodules --refresh; then
-       echo >&2 "cannot rebase: you have unstaged changes"
-       exit 1
+       die "cannot rebase: you have unstaged changes"
 fi
 diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
 case "$diff" in