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

[PATCH (girocco) 2/3] taskd/clone: ask git-svn to store branches under svn-origin/heads/* instead of svn-origin/*

From
Kirill Smelkov <kirr@landau.phys.spbu.ru>
Date
Sep 18, 2010, 09:58 UTC
Message-ID
<9b21791c9138823862157c5889181543ac4f1f2a.1284803429.git.kirr@landau.phys.spbu.ru>
In-Reply-To
<cover.1284803429.git.kirr@landau.phys.spbu.ru>
The trick originally suggested by Mikls Vajna does the following:
    refs/remotes/svn-origin/heads/*     ->  refs/heads/*
    refs/remotes/svn-origin/trunk       ->  refs/heads/master
    refs/remotes/svn-origin/tags/*      ->  refs/tags/*

The problem is git-svn now stores svn branches under refs/remotes/svn-origin/* (not refs/remotes/svn-origin/heads/* as we used to expect), and so the first mapping does nothing, and we end up without svn branches in refs/heads/ namespace.

So, to avoid the problem let's ask git-svn to put svn branches under svn-origin/heads/* -- then our mapping will work as expected, and it will fix girocco problem of not propagating svn branches (except trunk) to git refs/heads/ namespace.

Note: we can't write ``+refs/remotes/svn-origin/*:refs/heads/*'' in the
mapping instead, because then it will recursively put everything from
under svn-origin/ into refs/heads/ , at least including tags/ .
( Eric, at least it seems a bit unflexible for storing svn branches right under
  $prefix/ -- as you can see for automated git mirroring of svn repos, I
  had to tweak git config by hand... )
Cc: Andrew Steinborn <g33kdyoo@gmail.com>
Cc: Miklos Vajna <vmiklos@frugalware.org>
Cc: Eric Wong <normalperson@yhbt.net>
---
 taskd/clone.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/taskd/clone.sh b/taskd/clone.sh
index 8d56e1e..12363e5 100755
--- a/taskd/clone.sh
+++ b/taskd/clone.sh
@@ -26,6 +26,10 @@ case "$url" in
 		# we just remote svn+ here, so svn+http://... becomes http://...
 		svnurl="${url#svn+}"
 		GIT_DIR=. git svn init -s --prefix=svn-origin/ "$svnurl"
+		# ask git-svn to store branches under svn-origin/heads/* instead of svn-origin/*
+		GIT_DIR=. git config svn-remote.svn.branches	\
+			"$(git config --get svn-remote.svn.branches |	\
+			   sed 's|:refs/remotes/svn-origin/\*$|:refs/remotes/svn-origin/heads/*|')"
 		GIT_DIR=. git svn fetch
 		# Neat Trick suggested by Miklos Vajna
 		GIT_DIR=. git config remote.origin.url .
-- 
1.7.3.rc2.1.g63647
Previous: Kirill SmelkovNext: Kirill Smelkov
Message 3 of 5 in “Fix svn mirroring of branches + more...”
  1. 0/3 Fix svn mirroring of branches + more...Kirill Smelkov, Sep 18, 2010
  2. 1/3 taskd/clone: Store git-svn refs under svn-origin remoteKirill Smelkov, Sep 18, 2010
  3. 2/3 taskd/clone: ask git-svn to store branches under svn-origin/heads/* instead of svn-origin/*Kirill Smelkov, Sep 18, 2010
  4. 3/3 Revert "Finalized fix, we can't git fetch any longer."Kirill Smelkov, Sep 18, 2010
  5. Kirill SmelkovSep 25, 2010

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.