git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 6/9] contrib/git-svn: create a more recent master if one does not exist

From
EWEric Wong <normalperson@yhbt.net>
Date
Mar 3, 2006, 09:20 UTC
Message-ID
<11413776092820-git-send-email-normalperson@yhbt.net>
In-Reply-To
<11413776081545-git-send-email-normalperson@yhbt.net>

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>
---
 contrib/git-svn/git-svn.perl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
7d3cf853ffbe0d1ce8a15fa5ac3dad793ddb5021
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 5d547e8..69b6be3 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -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 $!;
@@ -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;
 }
 
-- 
1.2.3.g4676
Previous: Eric Wong
Message 2 of 2 in “contrib/git-svn: cleanup option parsing”
  1. 5/9 contrib/git-svn: cleanup option parsingEric Wong, Mar 3, 2006
  2. 6/9 contrib/git-svn: create a more recent master if one does not existEric Wong, Mar 3, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.