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

Re: Converting to Git using svn-fe (Was: Speeding up the initial git-svn fetch)

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 18, 2010, 19:33 UTC
Message-ID
<20101018193311.GE6877@burratino>
In-Reply-To
<AANLkTi=tT=AHWhHUw1tWT777ZPjvmTuMjDJ_orHYYN-x@mail.gmail.com>
Sverre Rabbelier wrote:
> On Mon, Oct 18, 2010 at 13:25, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 6 quoted lines
>> Good question.  Ram, I think there was some discussion of this
>> recently in connection with svnrdump, right?  IIRC the suggested
>> method was to use hooks or mine a commits@ mailing list. :(
>
> Hmmm, in that case perhaps we should instead just ignore changed
> history?
Yeah.  It's unpleasant to imagine that
	git clone svn://whatever
	... sneakily change svn repo ...
	... add some new revs on top ...
	cd whatever && git fetch origin

would produce an origin/trunk that does not match any clone of the svn repo at all, but in practice it is not so different from coping with any other upstream that is incurably willing to rewrite history.

Example: downstream tracking an unstable branch
-----------------------------------------------
Suppose I maintain a patchset in the long term, based, for whatever
reason, on git's "next" branch.  Occasionally there is a need to
merge from upstream.  What can one do?

Simple use of "git merge" produces history that is difficult to follow. Time flowing from left to right, "u" denotes upstream commits:

  u --- u --- u [next-2005-01-03]
  |\           \
  | \           A --- o - o ----- B
   \ \                   /       /
    \ u --- u --- u --- u [next-2006-03-27]
     \                         /
      u --- u --- u --- u --- u [next-2009-11-27]

If a person wants to find what changed downstream between A and B, a simple "git log A..B ^origin/next" will unfortunately include the commits from next-2006-03-27 as well.

One option is to rebase whenever upstream does, but that is dangerous because it prevents users from tracking changes in the project long-term.

Another option is to use a "rebasing merge" [1]. The history can be followed without too much trouble if you set up "git log" commands appropriately. Naïve use of "git log" will list (and git will store) multiple copies of every commit, though.

And lastly, one can say "screw upstream" and produce a long-term "next" branch to build on. :) Like this:

 1. git branch long-term-next next-2005-01-03
 2. When "next" is rebased to clean out cruft, advance long-term-next
    to the pre-rebase state.  Luckily such rebases leave a "before" in
    long-term-next and "after" in next with identical content.  Add a
    replace ref to make history easy to follow.
	git diff <after> <before>; # confirm that they really match
	git replace <after> <before>
 3. To advance long-term-next, rewrite commits from upstream.
	git checkout origin/next
	git filter-branch HEAD
	git diff origin/next; # should match
	git push . HEAD:long-term-next; # should be fast-forward
 4. Only merge long-term-next into downstream branches.
 5. Publish the latest replace ref so others can follow the history
    easily.
[1] http://thread.gmane.org/gmane.comp.version-control.msysgit/10264
Previous: Sverre RabbelierNext: Ramkumar Ramachandra
Message 26 of 52 in “Speeding up the initial git-svn fetch”
  1. Matt StumpOct 13, 2010
  2. Stephen BashOct 13, 2010
  3. Matt StumpOct 13, 2010
  4. Stephen BashOct 13, 2010
  5. Converting to Git using svn-fe (Was: Speeding up the initial git-svn fetch)Stephen Bash, Oct 14, 2010
  6. Jonathan NiederOct 14, 2010
  7. Sverre RabbelierOct 14, 2010
  8. Stephen BashOct 15, 2010
  9. Sverre RabbelierOct 15, 2010
  10. Stephen BashOct 16, 2010
  11. Sverre RabbelierOct 17, 2010
  12. David Michael BarrOct 17, 2010
  13. Ramkumar RamachandraOct 18, 2010
  14. Jonathan NiederOct 18, 2010
  15. Ramkumar RamachandraOct 18, 2010
  16. Sverre RabbelierOct 18, 2010
  17. Jonathan NiederOct 18, 2010
  18. Ramkumar RamachandraOct 18, 2010
  19. Sverre RabbelierOct 18, 2010
  20. Jonathan NiederOct 18, 2010
  21. Sverre RabbelierOct 18, 2010
  22. Jonathan NiederOct 18, 2010
  23. Sverre RabbelierOct 18, 2010
  24. Jonathan NiederOct 18, 2010
  25. Sverre RabbelierOct 18, 2010
  26. Jonathan NiederOct 18, 2010
  27. Ramkumar RamachandraOct 19, 2010
  28. Stephen BashOct 19, 2010
  29. Stephen BashOct 19, 2010
  30. Ramkumar RamachandraOct 19, 2010
  31. Stephen BashOct 19, 2010
  32. David Michael BarrOct 19, 2010
  33. Stephen BashOct 19, 2010
  34. Will PalmerOct 20, 2010
  35. Jakub NarebskiOct 20, 2010
  36. Will PalmerOct 20, 2010
  37. Jakub NarebskiOct 20, 2010
  38. mrevilgnomeOct 21, 2010
  39. Jakub NarebskiOct 21, 2010
  40. Stephen BashOct 21, 2010
  41. Will PalmerOct 21, 2010
  42. Stephen BashOct 21, 2010
  43. Jakub NarebskiOct 21, 2010
  44. Stephen BashOct 21, 2010
  45. Jakub NarebskiOct 21, 2010
  46. Stephen BashOct 21, 2010
  47. Jakub NarebskiOct 22, 2010
  48. Jakub NarebskiOct 21, 2010
  49. Jonathan NiederOct 21, 2010
  50. Ramkumar RamachandraOct 20, 2010
  51. Stephen BashOct 20, 2010
  52. Ramkumar RamachandraOct 20, 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.