summaryrefslogtreecommitdiff
path: root/git-rebase--am.sh
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2014-07-15 20:14:02 +0100
committerJunio C Hamano <gitster@pobox.com>2014-07-15 15:05:02 -0700
commitb6266dc88b1fcc91d084cc9c65e0b0805cf59d55 (patch)
treec514e58bfd52b3cc2f9cd08e9c1fa39f0e85cab2 /git-rebase--am.sh
parent3d15f536a7f5215eddae20214fb8eaeeb6baaf27 (diff)
downloadgit-b6266dc88b1fcc91d084cc9c65e0b0805cf59d55.tar.gz
rebase--am: use --cherry-pick instead of --ignore-if-in-upstream
When using `git format-patch --ignore-if-in-upstream` we are only allowed to give a single revision range. In the next commit we will want to add an additional exclusion revision in order to handle fork points correctly, so convert `git-rebase--am` to use a symmetric difference with `--cherry-pick --right-only`. This does not change the result of the format-patch invocation, just how we spell the arguments. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--am.sh')
-rw-r--r--git-rebase--am.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index ca20e1e66f..902bf2d969 100644
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
@@ -29,7 +29,13 @@ skip)
;;
esac
-test -n "$rebase_root" && root_flag=--root
+if test -z "$rebase_root"
+ # this is now equivalent to ! -z "$upstream"
+then
+ revisions=$upstream...$orig_head
+else
+ revisions=$onto...$orig_head
+fi
ret=0
if test -n "$keep_empty"
@@ -38,14 +44,15 @@ then
# 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 "$revisions"
+ git cherry-pick ${gpg_sign_opt:+"$gpg_sign_opt"} --allow-empty \
+ --right-only "$revisions"
ret=$?
else
rm -f "$GIT_DIR/rebased-patches"
- git format-patch -k --stdout --full-index --ignore-if-in-upstream \
+ git format-patch -k --stdout --full-index --cherry-pick --right-only \
--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
- $root_flag "$revisions" >"$GIT_DIR/rebased-patches"
+ "$revisions" >"$GIT_DIR/rebased-patches"
ret=$?
if test 0 != $ret