Skip to content

Commit

Permalink
contrib/git-svn: create a more recent master if one does not exist
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Wong authored and Junio C Hamano committed Mar 3, 2006
1 parent eeb0abe commit 7f60b22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contrib/git-svn/git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ sub fetch {
sys(@svn_co, $SVN_URL, $SVN_WC);
chdir $SVN_WC or croak $!;
$last_commit = git_commit($base, @parents);
unless (-f "$GIT_DIR/refs/heads/master") {
sys(qw(git-update-ref refs/heads/master),$last_commit);
}
assert_svn_wc_clean($base->{revision}, $last_commit);
} else {
chdir $SVN_WC or croak $!;
Expand All @@ -242,6 +239,9 @@ sub fetch {
$last_commit = git_commit($log_msg, $last_commit, @parents);
}
assert_svn_wc_clean($last_rev, $last_commit);
unless (-e "$GIT_DIR/refs/heads/master") {
sys(qw(git-update-ref refs/heads/master),$last_commit);
}
return pop @$svn_log;
}

Expand Down

0 comments on commit 7f60b22

Please sign in to comment.