Skip to content

Commit bc2bbc4

Browse files
bebarinogitster
authored andcommitted
pull, rebase: simplify to use die()
Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 50a991e commit bc2bbc4

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

git-pull.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,11 @@ case "$merge_head" in
176176
?*' '?*)
177177
if test -z "$orig_head"
178178
then
179-
echo >&2 "Cannot merge multiple branches into empty head"
180-
exit 1
179+
die "Cannot merge multiple branches into empty head"
181180
fi
182181
if test true = "$rebase"
183182
then
184-
echo >&2 "Cannot rebase onto multiple branches"
185-
exit 1
183+
die "Cannot rebase onto multiple branches"
186184
fi
187185
;;
188186
esac

git-rebase.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,8 @@ run_pre_rebase_hook () {
168168
if test -z "$OK_TO_SKIP_PRE_REBASE" &&
169169
test -x "$GIT_DIR/hooks/pre-rebase"
170170
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."
175173
fi
176174
}
177175

@@ -359,8 +357,7 @@ fi
359357

360358
# The tree must be really really clean.
361359
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"
364361
fi
365362
diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
366363
case "$diff" in

0 commit comments

Comments
 (0)