git pull: Support --preserve-merges as a flag to rebase
PATCH 3/3 git pull: Support --preserve-merges as a flag to rebase
Now that "git rebase" supports non-interactive rebases preserving merges, this patch is the next logical step for those who wish to use such a workflow.
Since this patch makes the last test marked as expecting failure in t3409-rebase-preserve-merges, we now alter it to expect success.
---
Documentation/git-pull.txt | 4 ++++ git-pull.sh | 6 +++++- t/t3409-rebase-preserve-merges.sh | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-)
Documentation/git-pull.txt +0 -1
@@ -47,6 +47,10 @@ unless you have read linkgit:git-rebase[1] carefully. --no-rebase::
Override earlier --rebase.
+--preserve-merges::
+ Preserves merge commits when rebasing. Implies --rebase,
+ so the same warnings naturally apply.
+
include::fetch-options.txt[]
include::pull-fetch-param.txt[]
git-pull.sh +0 -0
@@ -58,6 +58,10 @@ do
-r|--r|--re|--reb|--reba|--rebas|--rebase) rebase=true ;; + --preserve-merges) # no short option for this + preserve_merges="--preserve-merges" + rebase=true + ;; --no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase) rebase=false ;;
@@ -179,7 +183,7 @@ fi
merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit test true = "$rebase" &&
- exec git-rebase $strategy_args --onto $merge_head \
+ exec git-rebase $preserve_merges $strategy_args --onto $merge_head \
${oldremoteref:-$merge_head}exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \
"$merge_name" HEAD $merge_head
t/t3409-rebase-preserve-merges.sh +0 -0
@@ -51,7 +51,7 @@ test_expect_success 'setup for merge-preserving rebase' \
git commit -a -m "Modify B2"
'
-test_expect_failure 'git pull --rebase -p on moved topic' ' +test_expect_success 'git pull --rebase -p on moved topic' '
cd clone1 && git pull --rebase --preserve-merges && test $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) = 1
Signature · 1 line
1.6.0.2.307.gc4275.dirty
Quoted 8 lines
Now that "git rebase" supports non-interactive rebases preserving merges, this patch is the next logical step for those who wish to use such a workflow.
Since this patch makes the last test marked as expecting failure in t3409-rebase-preserve-merges, we now alter it to expect success.
Does anyone know the current status of this?
The first 1/3 and 2/3 of this series is in next now (which grant non-interactive merge-preserving rebasing), but this additional --preserve-merges flag to git pull didn't seem to make it.
(Correct me if I'm wrong, I cannot pin point exactly where 1/2 and 2/3 got merged in, I'm just cheating and looking at the files as they exist in next's tip.)
My grandeur plan is to have this 3/3 go in as well and then follow it up with my patch to add a branch.name.preservemerges config variable.
This will make our internal workflow of "always rebase local changes/always preserve local merges" just work with "git pull".
Does this seem reasonable?
Thanks,
Stephen