git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Sergey Yanovich <ynvich@gmail.com>
Cc: git@vger.kernel.org, J.Sixt@eudaptics.com, masterdriverz@gmail.com
Subject: Re: [PATCH 1/3] Accept root <tree-ish> in 'git-svn commit-diff'
Date: Tue, 19 Jun 2007 23:25:48 -0700	[thread overview]
Message-ID: <20070620062548.GA25840@muzzle> (raw)
In-Reply-To: <cff8d32813e43d9e1c75ad50824d95dbcd6f669c.1182235491.git.ynvich@gmail.com>

Sergey Yanovich <ynvich@gmail.com> wrote:
> Experiments with Subversion (my version is 1.4.2) show that it is
> not necessary to call 'svn import' before the first commit. Contrarily
> to the Subversion documentation, first commit may be done even when
> Subversion repository is at revision 0.
> 
> This allow export the whole git branch to a Subversion repo using only
> 'git-svn commit-diff'. Before this patch, however, 'git-svn' had
> no means to operate on root commits.

Cool.

> Signed-off-by: Sergey Yanovich <ynvich@gmail.com>
> ---
>  git-svn.perl |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index 50128d7..8ad291b 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -2572,7 +2572,12 @@ sub generate_diff {
>  	}
>  	push @diff_tree, '--find-copies-harder' if $_find_copies_harder;
>  	push @diff_tree, "-l$_rename_limit" if defined $_rename_limit;
> -	push @diff_tree, $tree_a, $tree_b;
> +	if ($tree_a eq '0000000000000000000000000000000000000000') {

You can make this more legible by using '0' x40 instead of repeating
40 '0' characters.  Also, it might be a good idea to support --root
directly for git-svn so the user won't have to type 40 zeroes in the
command-line :)

> +		push @diff_tree, '--root';
> +	} else {
> +		push @diff_tree, $tree_a;
> +	}
> +	push @diff_tree, $tree_b;
>  	my ($diff_fh, $ctx) = command_output_pipe(@diff_tree);
>  	local $/ = "\0";
>  	my $state = 'meta';
> @@ -2606,6 +2611,8 @@ sub generate_diff {
>  			}
>  			$x->{file_b} = $_;
>  			$state = 'meta';
> +		} elsif ($state eq 'meta' && $_ eq $tree_b &&
> +			$tree_a eq '0000000000000000000000000000000000000000') {

Same here with '0' x40

>  		} else {
>  			croak "Error parsing $_\n";
>  		}
> -- 
> 1.5.2.1
> 

-- 
Eric Wong

  parent reply	other threads:[~2007-06-20  6:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-18 12:14 git tool to keep a subversion mirror Sergey Yanovich
     [not found] ` <cff8d32813e43d9e1c75ad50824d95dbcd6f669c.1182235491.git.ynvich@gmail.com>
2007-06-19  6:54   ` [PATCH 1/3] Accept root <tree-ish> in 'git-svn commit-diff' Sergey Yanovich
     [not found]   ` <ad3394d949e01bf962120ad69f59f4017ca5466b.1182235492.git.ynvich@gmail.com>
2007-06-19  6:54     ` [PATCH 3/3] Fix large-scale exports by 'git-svndump' Sergey Yanovich
2007-06-20  6:25   ` Eric Wong [this message]
2007-06-20  9:20     ` [PATCH 1/3] Accept root <tree-ish> in 'git-svn commit-diff' Sergey Yanovich
     [not found]   ` <7d5543ebd8ac45e49a6d3f300e988189561512f1.1182235492.git.ynvich@gmail.com>
2007-06-19  6:54     ` [PATCH 2/3] 'git-svndump' Sergey Yanovich
2007-06-20  6:40     ` Eric Wong
2007-06-20  9:47       ` Sergey Yanovich
  -- strict thread matches above, loose matches on Subject: below --
2007-06-17 18:49 git tool to keep a subversion mirror Sergey Yanovich
2007-06-17 21:09 ` Matthieu Moy
2007-06-18  6:42   ` Sergey Yanovich
     [not found]   ` <4e79874760c3773448d886608d6db7bbda3c97f2.1182168501.git.ynvich@gmail.com>
2007-06-18 12:14     ` [PATCH 1/3] Accept root <tree-ish> in 'git-svn commit-diff' Sergey Yanovich
2007-06-18 13:20       ` Johannes Sixt
     [not found]     ` <98e24b3eb0a0d34100d5ab9db052efaaa140c4ac.1182168501.git.ynvich@gmail.com>
2007-06-18 12:14       ` [PATCH 2/3] 'git-svndump' Sergey Yanovich
2007-06-18 12:26         ` Charlie Shepherd
     [not found]     ` <1cfe105017cb4bc44d54c6283b5185a73c4e84d8.1182168501.git.ynvich@gmail.com>
2007-06-18 12:14       ` [PATCH 3/3] Fix large-scale exports by 'git-svndump' Sergey Yanovich
2007-06-18 13:22         ` Johannes Sixt
2007-06-24  7:45 ` git tool to keep a subversion mirror Jan Hudec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070620062548.GA25840@muzzle \
    --to=normalperson@yhbt.net \
    --cc=J.Sixt@eudaptics.com \
    --cc=git@vger.kernel.org \
    --cc=masterdriverz@gmail.com \
    --cc=ynvich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).