@matheusbsbs / matheus-bagliano / commits / 171af11082
Fork 0

Add --no-rebase option to git-svn dcommit

git-svn dcommit exports commits to Subversion, then imports them back to git again, and last but not least rebases or resets HEAD to the last of the new commits. I guess this rebasing is convenient when using just git, but when the commits to be exported are managed by StGIT, it's really annoying. So add an option to disable this behavior. And document it, too! Signed-off-by: Karl Hasselström <kha@treskal.com> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Karl Hasselström committed May 3, 2007 at 07:51 UTC 171af11082d41f8e7a678e1e1a4ec6f610d01cf4
2 files changed +21 -15
Documentation/git-svn.txt
+3
@@ -119,6 +119,9 @@ and have no uncommitted changes.
119 alternative to HEAD.
120 This is advantageous over 'set-tree' (below) because it produces
121 cleaner, more linear history.
122 ++
123 +--no-rebase;;
124 + After committing, do not rebase or reset.
125 --
126
127 'log'::
git-svn.perl
+18 -15
@@ -55,7 +55,7 @@ $sha1_short = qr/[a-f\d]{4,40}/;
55 my ($_stdin, $_help, $_edit,
56 $_message, $_file,
57 $_template, $_shared,
58 - $_version, $_fetch_all,
58 + $_version, $_fetch_all, $_no_rebase,
59 $_merge, $_strategy, $_dry_run, $_local,
60 $_prefix, $_no_checkout, $_verbose);
61 $Git::SVN::_follow_parent = 1;
@@ -114,6 +114,7 @@ my %cmd = (
114 'verbose|v' => \$_verbose,
115 'dry-run|n' => \$_dry_run,
116 'fetch-all|all' => \$_fetch_all,
117 + 'no-rebase' => \$_no_rebase,
118 %cmt_opts, %fc_opts } ],
119 'set-tree' => [ \&cmd_set_tree,
120 "Set an SVN repository to a git tree-ish",
@@ -413,21 +414,23 @@ sub cmd_dcommit {
414 return;
415 }
416 $_fetch_all ? $gs->fetch_all : $gs->fetch;
416 - # we always want to rebase against the current HEAD, not any
417 - # head that was passed to us
418 - my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
419 - my @finish;
420 - if (@diff) {
421 - @finish = rebase_cmd();
422 - print STDERR "W: HEAD and ", $gs->refname, " differ, ",
423 - "using @finish:\n", "@diff";
424 - } else {
425 - print "No changes between current HEAD and ",
426 - $gs->refname, "\nResetting to the latest ",
427 - $gs->refname, "\n";
428 - @finish = qw/reset --mixed/;
417 + unless ($_no_rebase) {
418 + # we always want to rebase against the current HEAD, not any
419 + # head that was passed to us
420 + my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
421 + my @finish;
422 + if (@diff) {
423 + @finish = rebase_cmd();
424 + print STDERR "W: HEAD and ", $gs->refname, " differ, ",
425 + "using @finish:\n", "@diff";
426 + } else {
427 + print "No changes between current HEAD and ",
428 + $gs->refname, "\nResetting to the latest ",
429 + $gs->refname, "\n";
430 + @finish = qw/reset --mixed/;
431 + }
432 + command_noisy(@finish, $gs->refname);
433 }
430 - command_noisy(@finish, $gs->refname);
434 }
435
436 sub cmd_find_rev {