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

parent-filter loses my merged branch -- what am I doing wrong?

From
Ask Bjørn Hansen <ask@develooper.com>
Date
Jan 19, 2009, 03:45 UTC
Message-ID
<7578B9A6-BF81-4096-B0FD-F433AD62A41E@develooper.com>
Hi everyone,

I'm converting another svn repository to git (yay). It's only about 1000 commits, but over more than 7 years and a cvs->svn conversion.

On Sam Villain's recommendation I'm spending a bit of time cleaning up the branches and merges with git filter-branch, but I don't think I'm quite understanding how it's supposed to work.

I put the repository up here (about 1MB):
	git clone git://git.develooper.com/qpsmtpd.git

I started out making a temporary tag for each svn commit, to have easier to use reference points:

for c in `git rev-list --all --date-order --timestamp | sort -n | awk  
'{print $2}'`; do
   svnid=`git show -s $c | tail -1 | sed 's/.*svn.perl.org\/qpsmtpd 
\///' | sed 's/\ .*//' | sed 's/^branches\///'`
   git tag -f $svnid $c
done

Then I tried getting the first merge adjusted to show both parents. The commit tagged v010@56 should be the second parent for trunk@57 (the original/other parent for trunk@57 is trunk@20).

I tried using:
git filter-branch --tag-name-filter cat --parent-filter '
                  if test $GIT_COMMIT = $(git rev-parse trunk@57)
                  then
                     echo "-p $(git rev-parse trunk@20) -p $(git rev- 
parse v010@56)"
                  else
                     cat
                  fi
         ' \
master

... but that seems to just basically throw away the "v010" branch! What did I do wrong? (Some of the other problems with this repository is that we moved the branches around with "svn mv", so some of the branches don't even have the branch point as a parent; but I'll get back to that when I get this simple case working).

(The script also loses all the temporary tags I added; I thought "-- tag-name-filter cat" would preserve them?)

  - ask
-- 
http://develooper.com/ - http://askask.com/
Next: Johannes Sixt
Message 1 of 3 in “parent-filter loses my merged branch -- what am I doing wrong?”
  1. Ask Bjørn HansenJan 19, 2009
  2. Johannes SixtJan 19, 2009
  3. Ask Bjørn HansenJan 20, 2009

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.