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

Re: Three issues from a Subversion-to-git migration

From
Thomas Rast <trast@student.ethz.ch>
Date
Mar 29, 2010, 09:32 UTC
Message-ID
<201003291132.53415.trast@student.ethz.ch>
In-Reply-To
<20100329091056.GC10538@thyrsus.com>
Eric Raymond wrote:
Show 15 quoted lines
> > I've used the following hack to make real tags out of SVN "tags":
> > 
> > git for-each-ref --format="%(refname)" refs/remotes/tags/ |
> > while read tag; do
> >     GIT_COMMITTER_DATE="$(git log -1 --pretty=format:"%ad" "$tag")" \
> >     GIT_COMMITTER_EMAIL="$(git log -1 --pretty=format:"%ce" "$tag")" \
> >     GIT_COMMITTER_NAME="$(git log -1 --pretty=format:"%cn" "$tag")" \
> >     git tag -m "$(git log -1 --pretty=format:"%s%n%b" "$tag")" \
> >     "${tag#refs/remotes/tags/}" "$tag"
> > done
> > 
> > Disclaimer: it worked last time I used it.  Haven't checked if it got
> > dusty since.
> 
> Wow, that's ugly. But it does look like it ought to work.

BTW, you'll also want to use some treatment that removes the empty commit that is generated from the 'svn copy' SVN commit for tagging. One option is to use 'git filter-branch --prune-empty ...', which will also drop other no-op commits. If you want to remove only the ones that come from tagging, creative use of git-diff-tree in the above loop will work.

I suppose I was never bothered by the lack of automatic tagging because I rarely found a git-svn import to be immediately fit for publishing. Usually it took some grafting and other filtering to bring the history into shape anyway. Maybe now that the svn:mergeinfo support obviates the need for grafting, it's worth thinking about the rest.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Eric RaymondNext: Eric Raymond
Message 4 of 7 in “Three issues from a Subversion-to-git migration”
  1. Eric RaymondMar 26, 2010
  2. Thomas RastMar 29, 2010
  3. Eric RaymondMar 29, 2010
  4. Thomas RastMar 29, 2010
  5. Eric RaymondMar 29, 2010
  6. Gabriel FilionMar 29, 2010
  7. Eric RaymondMar 29, 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.