rebase-interactive: simplify pick_on_preserving_merges
authorWink Saville <wink@saville.com>
Fri, 23 Mar 2018 04:39:52 +0000 (21:39 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 Mar 2018 17:42:05 +0000 (10:42 -0700)
Use compound if statement instead of nested if statements to
simplify pick_on_preserving_merges.

Signed-off-by: Wink Saville <wink@saville.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--interactive.sh
index 331c8dfeac3cac2fd2d9d9287d5c487669fe80a0..561e2660ed424621ff2761a01557c1238bee6310 100644 (file)
@@ -307,17 +307,14 @@ pick_one_preserving_merges () {
        esac
        sha1=$(git rev-parse $sha1)
 
-       if test -f "$state_dir"/current-commit
+       if test -f "$state_dir"/current-commit && test "$fast_forward" = t
        then
-               if test "$fast_forward" = t
-               then
-                       while read current_commit
-                       do
-                               git rev-parse HEAD > "$rewritten"/$current_commit
-                       done <"$state_dir"/current-commit
-                       rm "$state_dir"/current-commit ||
-                               die "$(gettext "Cannot write current commit's replacement sha1")"
-               fi
+               while read current_commit
+               do
+                       git rev-parse HEAD > "$rewritten"/$current_commit
+               done <"$state_dir"/current-commit
+               rm "$state_dir"/current-commit ||
+                       die "$(gettext "Cannot write current commit's replacement sha1")"
        fi
 
        echo $sha1 >> "$state_dir"/current-commit