Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Wesley Schwengle <wesleys@opperschaap.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] git-svn: don't print v1-layout migration noise when there's nothing to migrate
Date: Thu, 27 Aug 2026 10:42:11 -0700	[thread overview]
Message-ID: <xmqqy0dr8npo.fsf@gitster.g> (raw)
In-Reply-To: <20260827165134.848207-2-wesleys@opperschaap.net> (Wesley Schwengle's message of "Thu, 27 Aug 2026 12:51:33 -0400")

Wesley Schwengle <wesleys@opperschaap.net> writes:

> -	print STDERR "Migrating from a git-svn v1 layout...\n";
> -	mkpath([$svn_dir]);
> -	print STDERR "Data from a previous version of git-svn exists, but\n\t",
> -	             "$svn_dir\n\t(required for this version ",
> -	             "($::VERSION) of git-svn) does not exist.\n";
>  	my ($fh, $ctx) = command_output_pipe(qw/rev-parse --symbolic --all/);
>  	while (<$fh>) {
>  		my $x = $_;
>  		next unless $x =~ s#^refs/remotes/##;
>  		chomp $x;
>  		my $info_url = command_oneline(qw(rev-parse --git-path),
>  						"$x/info/url");
>  		next unless -f $info_url;
>  		my $u = eval { ::file_to_s($info_url) };
>  		next unless $u;
> +		unless ($migrated) {
> +			print STDERR "Migrating from a git-svn v1 layout...\n";
> +			mkpath([$svn_dir]);
> +			print STDERR "Data from a previous version of ",
> +				     "git-svnexists, but\n\t",
> +				     "$svn_dir\n\t(required for this version ",
> +				     "($::VERSION) of git-svn) does not ",
> +				     "exist.\n";
> +		}

Delaying the initialization and messaging is a reasonable idea, but
you lost a SP in the message (there might be other changes I failed
to spot---I wasn't especially being careful).

>  		my $dn = dirname("$svn_dir/$x");
>  		mkpath([$dn]) unless -d $dn;
>  		if ($x eq 'svn') { # they used 'svn' as GIT_SVN_ID:
>  			mkpath(["$svn_dir/svn"]);
>  			print STDERR " - $git_dir/$x/info => ",
>  			                "$svn_dir/$x/info\n";
>  			rename "$git_dir/$x/info", "$svn_dir/$x/info" or
>  			       croak "$!: $x";
>  			# don't worry too much about these, they probably
>  			# don't exist with repos this old (save for index,
> @@ -120,21 +124,21 @@ sub migrate_from_v1 {
>  			foreach my $f (qw/unhandled.log index .rev_db/) {
>  				rename "$git_dir/$x/$f", "$svn_dir/$x/$f";
>  			}
>  		} else {
>  			print STDERR " - $git_dir/$x => $svn_dir/$x\n";
>  			rename "$git_dir/$x", "$svn_dir/$x" or croak "$!: $x";
>  		}
>  		$migrated++;
>  	}
>  	command_close_pipe($fh, $ctx);
> -	print STDERR "Done migrating from a git-svn v1 layout\n";
> +	print STDERR "Done migrating from a git-svn v1 layout\n" if $migrated;
>  	$migrated;
>  }
>  
>  sub read_old_urls {
>  	my ($l_map, $pfx, $path) = @_;
>  	my @dir;
>  	foreach (<$path/*>) {
>  		if (-r "$_/info/url") {
>  			$pfx .= '/' if $pfx && $pfx !~ m!/$!;
>  			my $ref_id = $pfx . basename $_;
> diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
> index 6d7d2aa491..a27f7f6171 100755
> --- a/t/t9107-git-svn-migrate.sh
> +++ b/t/t9107-git-svn-migrate.sh
> @@ -1,15 +1,22 @@
>  #!/bin/sh
>  # Copyright (c) 2006 Eric Wong
>  test_description='git svn metadata migrations from previous versions'
>  . ./lib-git-svn.sh
>  
> +test_expect_success 'migrate is silent when there is nothing to migrate' '
> +	git svn migrate 2>err.log &&
> +	test_grep ! "Migrating from a git-svn v1 layout" err.log &&
> +	test_grep ! "Data from a previous version of git-svn exists" err.log &&
> +	! test -d "$GIT_DIR"/svn
> +	'
> +
>  test_expect_success 'setup old-looking metadata' '
>  	cp "$GIT_DIR"/config "$GIT_DIR"/config-old-git-svn &&
>  	mkdir import &&
>  	(
>  		cd import &&
>  		for i in trunk branches/a branches/b tags/0.1 tags/0.2 tags/0.3
>  		do
>  			mkdir -p $i &&
>  			echo hello >>$i/README ||
>  			exit 1

  reply	other threads:[~2026-08-27 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 16:51 [PATCH 0/2] git-svn: silence bogus v1-layout migration message Wesley Schwengle
2026-08-27 16:51 ` [PATCH 1/2] git-svn: don't print v1-layout migration noise when there's nothing to migrate Wesley Schwengle
2026-08-27 17:42   ` Junio C Hamano [this message]
2026-08-27 23:43     ` [PATCH v2 0/2] " Wesley Schwengle
2026-08-27 23:43       ` [PATCH v2 1/2] " Wesley Schwengle
2026-08-27 23:43       ` [PATCH v2 2/2] Makefile: add NO_GIT_SVN knob to skip building/installing git-svn Wesley Schwengle
2026-08-27 16:51 ` [PATCH " Wesley Schwengle

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=xmqqy0dr8npo.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=wesleys@opperschaap.net \
    /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