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

Stripping 'git-svn-id' from commit messages, and switching to svn.noMetadata

From
JIJM Ibanez <jm@orangeandbronze.com>
Date
Jan 23, 2008, 21:00 UTC
Message-ID
<877ii0p89b.fsf@adler.orangeandbronze.com>
Hi,

I've been trying to convert an existing git-svn clone to noMetadata (i.e. get rid of git-svn-id in the commit messages), primarily because I've been using it to track two SVN repos which were originally just a single repo-- they have the same UUID but are located on different machines, and have branched significantly, so content-wise are no longer the same repo.

Because the two repos have a single line of commits which they share, it would be best if I could store that history in my git repo (as I need to use it for merging between the two trees). Graphically, my current history looks something like this:

    A -- B -- C -- D -- E -- a -- b -- c
    A'-- B'-- C'-- D'-- E'-- x -- y -- z
where, in reality, this should be represented as:
    A -- B -- C -- D -- E -- a -- b -- c
                         \
                          +- x -- y -- z

Because the ancestor revisions (A..E) have different commit messages (because of the git-svn-id), they have differing SHA1 ids. Which means I have a hard time trying to track both branches using gitk.

I used git-filter-branch to strip off the git-svn-id lines, as follows:
 $ git filter-branch --msg-filter 'sed -e "s/^git-svn-id.*$//"' \
       --commit-filter 'NEW_SHA1=`git commit-tree "$@"`; \
         echo "s/$GIT_COMMIT/$NEW_SHA1/" >> $REMAP_FILE; \
         echo $NEW_SHA1' HEAD

The mappings between the old commit SHA1s and the new commit SHA1s I store in $REMAP_FILE (somewhere), which I then execute as a sed script against all my .rev_db files:

 $ find .git/svn/ -name '.rev_db' | xargs sed -f $REMAP_FILE -i.bak

Now, my problems is I've apparently confused git-svn. I can't seem to do a git-svn rebase on this particular repo. For the record, I've changed .git/config and set svn.noMetadata on this repo.

In particular, it seems that git-svn can't find the SVN metadata (even if .rev_db exists). Exact error is "Unable to determine upstream SVN information from working tree history".

The reason why I can't do a fresh git-svn clone of the two SVN repos is the repo is already at ~7700 revisions, with large files. I don't have the time to do a proper clone at the moment, and I tried this as an alternative.

And yes, I did all of this on a copy of an existing repo, not the original repo itself.

-- 
JM Ibanez
Software Architect
Orange & Bronze Software Labs, Ltd. Co.

jm@orangeandbronze.com
http://software.orangeandbronze.com/
Next: Sam Vilain
Message 1 of 7 in “Stripping 'git-svn-id' from commit messages, and switching to svn.noMetadata”
  1. JM IbanezJan 23, 2008
  2. Sam VilainJan 24, 2008
  3. JM IbanezJan 24, 2008
  4. Sam VilainJan 24, 2008
  5. Pascal ObryJan 24, 2008
  6. Sam VilainJan 24, 2008
  7. Pascal ObryJan 25, 2008

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.