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:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2018-03-20 14:10:57 +0300
committerJunio C Hamano <gitster@pobox.com>2018-03-29 21:09:03 +0300
commitda27a6fbd50861149b32cfd1f9e5c36a935c575a (patch)
tree4a98aa0527d270cd9b096ef18e8db2931daf7c68 /git-rebase--am.sh
parentb79966aa386fc58801e93496cd4e97d82acd53a5 (diff)
rebase --keep-empty: always use interactive rebase
rebase --merge accepts --keep-empty but just ignores it, by using an implicit interactive rebase the user still gets the rename detection of a merge based rebase but with with --keep-empty support. If rebase --keep-empty without --interactive or --merge stops for the user to resolve merge conflicts then 'git rebase --continue' will fail. This is because it uses a different code path that does not create $git_dir/rebase-apply. As rebase --keep-empty was implemented using cherry-pick it has never supported the am options and now that interactive rebases support --signoff there is no loss of functionality by using an implicit interactive rebase. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--am.sh')
-rw-r--r--git-rebase--am.sh78
1 files changed, 33 insertions, 45 deletions
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index 14c50782e0..91381d5872 100644
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
@@ -38,59 +38,47 @@ else
fi
ret=0
-if test -n "$keep_empty"
-then
- # we have to do this the hard way. git format-patch completely squashes
- # empty commits and even if it didn't the format doesn't really lend
- # itself well to recording empty patches. fortunately, cherry-pick
- # makes this easy
- git cherry-pick ${gpg_sign_opt:+"$gpg_sign_opt"} --allow-empty \
- $allow_rerere_autoupdate --right-only "$revisions" \
- ${restrict_revision+^$restrict_revision}
- ret=$?
-else
- rm -f "$GIT_DIR/rebased-patches"
+rm -f "$GIT_DIR/rebased-patches"
- git format-patch -k --stdout --full-index --cherry-pick --right-only \
- --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
- --pretty=mboxrd \
- $git_format_patch_opt \
- "$revisions" ${restrict_revision+^$restrict_revision} \
- >"$GIT_DIR/rebased-patches"
- ret=$?
+git format-patch -k --stdout --full-index --cherry-pick --right-only \
+ --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
+ --pretty=mboxrd \
+ $git_format_patch_opt \
+ "$revisions" ${restrict_revision+^$restrict_revision} \
+ >"$GIT_DIR/rebased-patches"
+ret=$?
- if test 0 != $ret
- then
- rm -f "$GIT_DIR/rebased-patches"
- case "$head_name" in
- refs/heads/*)
- git checkout -q "$head_name"
- ;;
- *)
- git checkout -q "$orig_head"
- ;;
- esac
+if test 0 != $ret
+then
+ rm -f "$GIT_DIR/rebased-patches"
+ case "$head_name" in
+ refs/heads/*)
+ git checkout -q "$head_name"
+ ;;
+ *)
+ git checkout -q "$orig_head"
+ ;;
+ esac
- cat >&2 <<-EOF
+ cat >&2 <<-EOF
- git encountered an error while preparing the patches to replay
- these revisions:
+ git encountered an error while preparing the patches to replay
+ these revisions:
- $revisions
+ $revisions
- As a result, git cannot rebase them.
- EOF
- return $ret
- fi
+ As a result, git cannot rebase them.
+ EOF
+ return $ret
+fi
- git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" \
- --patch-format=mboxrd \
- $allow_rerere_autoupdate \
- ${gpg_sign_opt:+"$gpg_sign_opt"} <"$GIT_DIR/rebased-patches"
- ret=$?
+git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" \
+ --patch-format=mboxrd \
+ $allow_rerere_autoupdate \
+ ${gpg_sign_opt:+"$gpg_sign_opt"} <"$GIT_DIR/rebased-patches"
+ret=$?
- rm -f "$GIT_DIR/rebased-patches"
-fi
+rm -f "$GIT_DIR/rebased-patches"
if test 0 != $ret
then