pull, rebase: simplify to use die()
Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stephen Boyd committed
Jun 14, 2009 at 16:08 UTC
bc2bbc4542a220da5d28c432b6bf78a845a421c0
2 files changed
+5
-10
git-pull.sh
+2
-4
@@ -176,13 +176,11 @@ case "$merge_head" in
176
?*' '?*)
177
if test -z "$orig_head"
178
then
179
- echo >&2 "Cannot merge multiple branches into empty head"
180
- exit 1
179
+ die "Cannot merge multiple branches into empty head"
180
fi
181
if test true = "$rebase"
182
then
184
- echo >&2 "Cannot rebase onto multiple branches"
185
- exit 1
183
+ die "Cannot rebase onto multiple branches"
184
fi
185
;;
186
esac
git-rebase.sh
+3
-6
@@ -168,10 +168,8 @@ run_pre_rebase_hook () {
168
if test -z "$OK_TO_SKIP_PRE_REBASE" &&
169
test -x "$GIT_DIR/hooks/pre-rebase"
170
then
171
- "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
172
- echo >&2 "The pre-rebase hook refused to rebase."
173
- exit 1
174
- }
171
+ "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} ||
172
+ die "The pre-rebase hook refused to rebase."
173
fi
174
}
175
@@ -359,8 +357,7 @@ fi
357
358
# The tree must be really really clean.
359
if ! git update-index --ignore-submodules --refresh; then
362
- echo >&2 "cannot rebase: you have unstaged changes"
363
- exit 1
360
+ die "cannot rebase: you have unstaged changes"
361
fi
362
diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
363
case "$diff" in