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

git-svn adding too many blank lines during git-cherry-pick, and git-cherry getting confused

From
Robin H. Johnson <robbat2@gentoo.org>
Date
Jun 2, 2007, 04:50 UTC
Message-ID
<20070602045007.GJ27013@curie-int.orbis-terrarum.net>
Hi,
Bit of weirdness I ran into.

I have a SVN tree, with a branch that gets some backported fixe (they usually apply cleanly).

I commit the fix to the trunk + git-svn dcommit, and then switch to the other branch, and git-cherry-pick the fix.

For git-svn commits, the log has: On the trunk side, there is a two blank line before git-svn-id. On the branch side, there are three blank lines before git-svn-id. If I cherry-pick from that branch to a third branch, I get 4 blank lines.

For regular SVN commits, the log has: Only a single blank line before git-svn-id.

I think the source of the problem is that git-svn-id is being removed when cherry-picking, but NOT the leading blank line.

This all leads to the hashes of the commits diverging badly, and then git-cherry gets very confused when asked to compare the trunk vs. the branches.

How do we solve it? This is only on a conceptual level here, looking at the present state of git-svn, I'm not sure how best to solve it.

git-svn fetch:
1. Get commit message from SVN. 
2. Trim ALL trailing blank lines (and existing git-svn-id lines).
3. If the last line was header-style (Signed-off-by, CC, etc)
3.1. if it was, do not add a blank line.
3.2. If not, add a single blank line.
4. Insert git-svn-id header.
git-svn dcommit:
1. Get commit message (git cat-file commit ....)
2. Remove the git-svn-id line.
3. Remove all trailing blank lines.
4. Commit.
-- 
Robin Hugh Johnson
Gentoo Linux Developer & Council Member
E-Mail     : robbat2@gentoo.org
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85
Next: Eric Wong
Message 1 of 2 in “git-svn adding too many blank lines during git-cherry-pick, and git-cherry getting confused”
  1. Robin H. JohnsonJun 2, 2007
  2. Eric WongJun 5, 2007

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.