svn: initial "master" points to trunk if possible
Since "trunk" is a convention for the main development branch in the SVN world, try to make that the master branch upon initial checkout if it exists. This is probably less surprising based on user requests. t9135 was the only test which relied on the previous behavior and thus needed to be modified. Signed-off-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
11
git-svn.perl
11
git-svn.perl
@ -1156,6 +1156,17 @@ sub post_fetch_checkout {
|
||||
my $gs = $Git::SVN::_head or return;
|
||||
return if verify_ref('refs/heads/master^0');
|
||||
|
||||
# look for "trunk" ref if it exists
|
||||
my $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};
|
||||
my $fetch = $remote->{fetch};
|
||||
if ($fetch) {
|
||||
foreach my $p (keys %$fetch) {
|
||||
basename($fetch->{$p}) eq 'trunk' or next;
|
||||
$gs = Git::SVN->new($fetch->{$p}, $gs->{repo_id}, $p);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my $valid_head = verify_ref('HEAD^0');
|
||||
command_noisy(qw(update-ref refs/heads/master), $gs->refname);
|
||||
return if ($valid_head || !verify_ref('HEAD^0'));
|
||||
|
Reference in New Issue
Block a user