contrib/git-svn: create a more recent master if one does not exist
In a new repository, the initial fetch creates a master branch if one does not exist so HEAD has something to point to. It now creates a master at the end of the initial fetch run, pointing to the latest revision. Previously it pointed to the first revision imported, which is generally less useful. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric Wong committed
Mar 3, 2006 at 01:20 UTC
7f60b228601becaa0bca2017521e1f27d5af70b1
1 file changed
+3
-3
contrib/git-svn/git-svn.perl
+3
-3
@@ -224,9 +224,6 @@ sub fetch {
224
sys(@svn_co, $SVN_URL, $SVN_WC);
225
chdir $SVN_WC or croak $!;
226
$last_commit = git_commit($base, @parents);
227
- unless (-f "$GIT_DIR/refs/heads/master") {
228
- sys(qw(git-update-ref refs/heads/master),$last_commit);
229
- }
227
assert_svn_wc_clean($base->{revision}, $last_commit);
228
} else {
229
chdir $SVN_WC or croak $!;
@@ -242,6 +239,9 @@ sub fetch {
239
$last_commit = git_commit($log_msg, $last_commit, @parents);
240
}
241
assert_svn_wc_clean($last_rev, $last_commit);
242
+ unless (-e "$GIT_DIR/refs/heads/master") {
243
+ sys(qw(git-update-ref refs/heads/master),$last_commit);
244
+ }
245
return pop @$svn_log;
246
}
247