git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [git-svn PATCH] Add --no-rebase option to git-svn dcommit

From
EWEric Wong <normalperson@yhbt.net>
Date
May 4, 2007, 08:04 UTC
Message-ID
<20070504080424.GA30555@muzzle>
In-Reply-To
<20070504075908.GB17526@muzzle>
Eric Wong <normalperson@yhbt.net> wrote:
Show 19 quoted lines
> Karl Hasselström <kha@treskal.com> wrote:
> > 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!
> 
> Cool, I've been planning to add this myself, too.
> 
> Acked-by: Eric Wong <normalperson@yhbt.net>
> 
> > Signed-off-by: Karl Hasselström <kha@treskal.com>
> > ---
> > 
> > Arguably, the switch should be --rebase instead, and default to not
> > rebase. But that would change the existing behavior, and possibly make
> > dcommit less convenient to use for at least the person who implemented
> > the existing behavior. Opinions?

Erm, sorry, I skipped over this part. No. I like rebase being the default behavior.

Show 77 quoted lines
> >  Documentation/git-svn.txt |    3 +++
> >  git-svn.perl              |   33 ++++++++++++++++++---------------
> >  2 files changed, 21 insertions(+), 15 deletions(-)
> > 
> > diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
> > index 62d7ef8..fcdeeaa 100644
> > --- a/Documentation/git-svn.txt
> > +++ b/Documentation/git-svn.txt
> > @@ -125,6 +125,9 @@ and have no uncommitted changes.
> >  	alternative to HEAD.
> >  	This is advantageous over 'set-tree' (below) because it produces
> >  	cleaner, more linear history.
> > ++
> > +--no-rebase;;
> > +	After committing, do not rebase or reset.
> >  --
> >  
> >  'log'::
> > diff --git a/git-svn.perl b/git-svn.perl
> > index 6657e10..3c4f490 100755
> > --- a/git-svn.perl
> > +++ b/git-svn.perl
> > @@ -55,7 +55,7 @@ $sha1_short = qr/[a-f\d]{4,40}/;
> >  my ($_stdin, $_help, $_edit,
> >  	$_message, $_file,
> >  	$_template, $_shared,
> > -	$_version, $_fetch_all,
> > +	$_version, $_fetch_all, $_no_rebase,
> >  	$_merge, $_strategy, $_dry_run, $_local,
> >  	$_prefix, $_no_checkout, $_verbose);
> >  $Git::SVN::_follow_parent = 1;
> > @@ -114,6 +114,7 @@ my %cmd = (
> >  			  'verbose|v' => \$_verbose,
> >  			  'dry-run|n' => \$_dry_run,
> >  			  'fetch-all|all' => \$_fetch_all,
> > +			  'no-rebase' => \$_no_rebase,
> >  			%cmt_opts, %fc_opts } ],
> >  	'set-tree' => [ \&cmd_set_tree,
> >  	                "Set an SVN repository to a git tree-ish",
> > @@ -413,21 +414,23 @@ sub cmd_dcommit {
> >  		return;
> >  	}
> >  	$_fetch_all ? $gs->fetch_all : $gs->fetch;
> > -	# we always want to rebase against the current HEAD, not any
> > -	# head that was passed to us
> > -	my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
> > -	my @finish;
> > -	if (@diff) {
> > -		@finish = rebase_cmd();
> > -		print STDERR "W: HEAD and ", $gs->refname, " differ, ",
> > -		             "using @finish:\n", "@diff";
> > -	} else {
> > -		print "No changes between current HEAD and ",
> > -		      $gs->refname, "\nResetting to the latest ",
> > -		      $gs->refname, "\n";
> > -		@finish = qw/reset --mixed/;
> > +	unless ($_no_rebase) {
> > +		# we always want to rebase against the current HEAD, not any
> > +		# head that was passed to us
> > +		my @diff = command('diff-tree', 'HEAD', $gs->refname, '--');
> > +		my @finish;
> > +		if (@diff) {
> > +			@finish = rebase_cmd();
> > +			print STDERR "W: HEAD and ", $gs->refname, " differ, ",
> > +				     "using @finish:\n", "@diff";
> > +		} else {
> > +			print "No changes between current HEAD and ",
> > +			      $gs->refname, "\nResetting to the latest ",
> > +			      $gs->refname, "\n";
> > +			@finish = qw/reset --mixed/;
> > +		}
> > +		command_noisy(@finish, $gs->refname);
> >  	}
> > -	command_noisy(@finish, $gs->refname);
> >  }
> >  
> >  sub cmd_find_rev {
-- 
Eric Wong
Previous: Eric WongNext: Karl Hasselström
Message 5 of 7 in “Add --no-rebase option to git-svn dcommit”
  1. Add --no-rebase option to git-svn dcommitKarl Hasselström, May 3, 2007
  2. David KågedalMay 3, 2007
  3. Seth FalconMay 3, 2007
  4. Eric WongMay 4, 2007
  5. Eric WongMay 4, 2007
  6. Karl HasselströmMay 4, 2007
  7. David KågedalMay 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.