Skip to content

Commit b6266dc

Browse files
johnkeepinggitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3d15f53 commit b6266dc

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

git-rebase--am.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ skip)
2929
;;
3030
esac
3131

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
3339

3440
ret=0
3541
if test -n "$keep_empty"
@@ -38,14 +44,15 @@ then
3844
# empty commits and even if it didn't the format doesn't really lend
3945
# itself well to recording empty patches. fortunately, cherry-pick
4046
# 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"
4249
ret=$?
4350
else
4451
rm -f "$GIT_DIR/rebased-patches"
4552

46-
git format-patch -k --stdout --full-index --ignore-if-in-upstream \
53+
git format-patch -k --stdout --full-index --cherry-pick --right-only \
4754
--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"
4956
ret=$?
5057

5158
if test 0 != $ret

0 commit comments

Comments
 (0)