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>
John Keeping committed
Jul 15, 2014 at 20:14 UTC
b6266dc88b1fcc91d084cc9c65e0b0805cf59d55
1 file changed
+11
-4
git-rebase--am.sh
+11
-4
@@ -29,7 +29,13 @@ skip)
29
;;
30
esac
31
32
-test -n "$rebase_root" && root_flag=--root
32
+if test -z "$rebase_root"
33
+ # this is now equivalent to ! -z "$upstream"
34
+then
35
+ revisions=$upstream...$orig_head
36
+else
37
+ revisions=$onto...$orig_head
38
+fi
39
40
ret=0
41
if test -n "$keep_empty"
@@ -38,14 +44,15 @@ then
44
# empty commits and even if it didn't the format doesn't really lend
45
# itself well to recording empty patches. fortunately, cherry-pick
46
# makes this easy
41
- git cherry-pick ${gpg_sign_opt:+"$gpg_sign_opt"} --allow-empty "$revisions"
47
+ git cherry-pick ${gpg_sign_opt:+"$gpg_sign_opt"} --allow-empty \
48
+ --right-only "$revisions"
49
ret=$?
50
else
51
rm -f "$GIT_DIR/rebased-patches"
52
46
- git format-patch -k --stdout --full-index --ignore-if-in-upstream \
53
+ git format-patch -k --stdout --full-index --cherry-pick --right-only \
54
--src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
48
- $root_flag "$revisions" >"$GIT_DIR/rebased-patches"
55
+ "$revisions" >"$GIT_DIR/rebased-patches"
56
ret=$?
57
58
if test 0 != $ret