Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-12-11 19:11:37 +0300
committerJunio C Hamano <gitster@pobox.com>2018-12-28 23:49:48 +0300
commit7b76ac664cbe68c64bf79bd37e8b5d5fe690ba29 (patch)
treed21143a89d5ec96712f29861d71d7a5d5d166bc3 /git-legacy-rebase.sh
parent899b49c446fa645419676899c9409e2975a5dd26 (diff)
git-legacy-rebase: simplify unnecessary triply-nested if
The git-legacy-rebase.sh script previously had code of the form: if git_am_opt: if interactive: if incompatible_opts: show_error_about_interactive_and_am_incompatibilities if rebase-merge: if incompatible_opts show_error_about_merge_and_am_incompatibilities which was a triply nested if. However, the first conditional (git_am_opt) and third (incompatible_opts) were somewhat redundant: the latter condition was a strict subset of the former. Simplify this by moving the innermost conditional to the outside, allowing us to remove the test on git_am_opt entirely and giving us the following form: if incompatible_opts: if interactive: show_error_about_interactive_and_am_incompatibilities if rebase-merge: show_error_about_merge_and_am_incompatibilities Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-legacy-rebase.sh')
-rwxr-xr-xgit-legacy-rebase.sh20
1 files changed, 8 insertions, 12 deletions
diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh
index f4088b7bda..6baf10192d 100755
--- a/git-legacy-rebase.sh
+++ b/git-legacy-rebase.sh
@@ -501,21 +501,17 @@ then
git_format_patch_opt="$git_format_patch_opt --progress"
fi
-if test -n "$git_am_opt"; then
- incompatible_opts=$(echo " $git_am_opt " | \
- sed -e 's/ -q / /g' -e 's/^ \(.*\) $/\1/')
+incompatible_opts=$(echo " $git_am_opt " | \
+ sed -e 's/ -q / /g' -e 's/^ \(.*\) $/\1/')
+if test -n "$incompatible_opts"
+then
if test -n "$interactive_rebase"
then
- if test -n "$incompatible_opts"
- then
- die "$(gettext "fatal: cannot combine am options with interactive options")"
- fi
+ die "$(gettext "fatal: cannot combine am options with interactive options")"
fi
- if test -n "$do_merge"; then
- if test -n "$incompatible_opts"
- then
- die "$(gettext "fatal: cannot combine am options with merge options")"
- fi
+ if test -n "$do_merge"
+ then
+ die "$(gettext "fatal: cannot combine am options with merge options")"
fi
fi