git-svn: support rebase --preserve-merges
When git svn rebase is performed after an unpushed merge, the rebase operation follows both parents and replays both the user's local commits and those from the merged branch. This is usually not the intended behavior. This patch adds support for the --preserve-merges/-p flag which allows for a better workflow by re-applying merge commits as merges. [ew: fixed a minor syntax error] Signed-off-by: Avishay Lavie <avishay.lavie@gmail.com> Signed-off-by: Eric Wong <normalperson@yhbt.net>
Avishay Lavie committed
May 15, 2012 at 11:45 UTC
b64e1f58158d1d1a8eafabbbf002a1a3c1d72929
2 files changed
+5
-1
Documentation/git-svn.txt
+2
@@ -572,6 +572,8 @@ config key: svn.repackflags
572
--merge::
573
-s<strategy>::
574
--strategy=<strategy>::
575
+-p::
576
+--preserve-merges::
577
These are only used with the 'dcommit' and 'rebase' commands.
578
+
579
Passed directly to 'git rebase' when using 'dcommit' if a
git-svn.perl
+3
-1
@@ -106,7 +106,7 @@ my ($_stdin, $_help, $_edit,
106
$_message, $_file, $_branch_dest,
107
$_template, $_shared,
108
$_version, $_fetch_all, $_no_rebase, $_fetch_parent,
109
- $_merge, $_strategy, $_dry_run, $_local,
109
+ $_merge, $_strategy, $_preserve_merges, $_dry_run, $_local,
110
$_prefix, $_no_checkout, $_url, $_verbose,
111
$_git_format, $_commit_url, $_tag, $_merge_info, $_interactive);
112
$Git::SVN::_follow_parent = 1;
@@ -255,6 +255,7 @@ my %cmd = (
255
'local|l' => \$_local,
256
'fetch-all|all' => \$_fetch_all,
257
'dry-run|n' => \$_dry_run,
258
+ 'preserve-merges|p' => \$_preserve_merges,
259
%fc_opts } ],
260
'commit-diff' => [ \&cmd_commit_diff,
261
'Commit a diff between two trees',
@@ -1592,6 +1593,7 @@ sub rebase_cmd {
1593
push @cmd, '-v' if $_verbose;
1594
push @cmd, qw/--merge/ if $_merge;
1595
push @cmd, "--strategy=$_strategy" if $_strategy;
1596
+ push @cmd, "--preserve-merges" if $_preserve_merges;
1597
@cmd;
1598
}
1599