diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-08-12 16:01:59 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-08-12 21:41:09 -0700 |
commit | b186a261b1f7ec1fbda8c5f6d84595f3a7716d92 (patch) | |
tree | 127158a516cf4a8e38bf8e7209eaa5c279f093bb /git-svn.perl | |
parent | 6ffd781226f04629eff63a684b47ad7555143312 (diff) | |
download | git-b186a261b1f7ec1fbda8c5f6d84595f3a7716d92.tar.gz |
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>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-x | git-svn.perl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl index b0bfb74792..fad29605db 100755 --- a/git-svn.perl +++ b/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')); |