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

Re: [PATCH] Enable and fix support for base less merges.

From
Fredrik Kuivinen <freku045@student.liu.se>
Date
Oct 5, 2005, 20:32 UTC
Message-ID
<20051005203230.GB1833@c165.ib.student.liu.se>
In-Reply-To
<46a038f90510032322t6623c8d4y969e4e00bf4dfe26@mail.gmail.com>
On Tue, Oct 04, 2005 at 07:22:04PM +1300, Martin Langhoff wrote:
Show 6 quoted lines
> On 10/4/05, Fredrik Kuivinen <freku045@student.liu.se> wrote:
> > I don't really understand what you mean. In what way could git-apply
> > use this? Is there a specific use case you are thinking about?
> 
> Hmmm, perhaps I'm not understanding what a 'base less' merge is.
>

A base less merge is a merge of two branches which do not have a common ancestor. That is, git-merge-base --all branch-A branch-B will not return any results.

Show 11 quoted lines
> Lately, I've been doing some "merges" where there was no common
> ancestor (known to git) and doing some lightweight cherrypicking by
> using `git-format-patch --mbox -o tmpdir` and then using
> git-applymbox. This is very useful to "replay" history against a
> different git repo (or branch) that doesn't share a common ancestor.
>
> But this has no support from the new smart merging mechanisms, which
> could potentially help by applying a patch to a renamed file. I'm not
> sure whether the "recursive" strategy needs 2 parents to figure this
> out, but if it doesn't, this'd be interesting to have. But at the time
> git-apply is cold, limited and unhelpful.

A base less merge is handled exactly as if there was a common ancestor for the two branches with an empty tree. Renames are detected by executing git-diff-tree -M --diff-filter=R -r <common ancestor> <branch-A> and the analogous command for <branch-B>. Hence, if <common ancestor> corresponds to an empty tree no renames will be detected.

I guess the major difference between cherrypicking with git-format-patch and merging is that a merge is pretty much an all or nothing thing. If you merge a branch you will get every commit from that branch (and if you don't merge you will obviously not get any commits at all).

> If baseless merges support what I am doing without resorting to
> patches, I'd be a really happy camper. Using mbox patchruns sucks,
> thank you very much for asking, because they don't support binary
> files.

It's unfortunate that binary files aren't supported. I have been thinking about doing something about it, there isn't any code yet though.

Anyway, the idea I have thought about is to use (probably base64-encoded) xdelta diffs for the binary files. With this approach git diffs could look like:

diff --git --xdelta a/foo b/foo
<base64-encoded xdelta data>

Is this approach reasonable?

- Fredrik
Previous: Fredrik KuivinenNext: Junio C Hamano
Message 38 of 39 in “What to expect after 0.99.8”
  1. Junio C HamanoOct 3, 2005
  2. A Large Angry SCMOct 3, 2005
  3. Junio C HamanoOct 3, 2005
  4. Enable and fix support for base less merges.Fredrik Kuivinen, Oct 3, 2005
  5. Josef WeidendorferOct 3, 2005
  6. Junio C HamanoOct 4, 2005
  7. Josef WeidendorferOct 4, 2005
  8. Junio C HamanoOct 4, 2005
  9. Random documentation fixesJonas Fonseca, Oct 3, 2005
  10. Daniel BarkalowOct 3, 2005
  11. Martin CoxallOct 3, 2005
  12. Nick HengeveldOct 3, 2005
  13. Daniel BarkalowOct 3, 2005
  14. Junio C HamanoOct 3, 2005
  15. Daniel BarkalowOct 3, 2005
  16. Junio C HamanoOct 3, 2005
  17. Linus TorvaldsOct 3, 2005
  18. Dan AloniOct 4, 2005
  19. Daniel BarkalowOct 4, 2005
  20. Matthias UrlichsOct 4, 2005
  21. H. Peter AnvinOct 4, 2005
  22. Matthias UrlichsOct 4, 2005
  23. H. Peter AnvinOct 4, 2005
  24. Junio C HamanoOct 4, 2005
  25. Linus TorvaldsOct 5, 2005
  26. H. Peter AnvinOct 5, 2005
  27. Daniel BarkalowOct 4, 2005
  28. H. Peter AnvinOct 4, 2005
  29. Daniel BarkalowOct 4, 2005
  30. Alan ChandlerOct 3, 2005
  31. H. Peter AnvinOct 3, 2005
  32. Greg KHOct 4, 2005
  33. H. Peter AnvinOct 5, 2005
  34. Matthias UrlichsOct 3, 2005
  35. Chuck LeverOct 4, 2005
  36. Junio C HamanoOct 4, 2005
  37. Fredrik KuivinenOct 4, 2005
  38. Fredrik KuivinenOct 5, 2005
  39. Junio C HamanoOct 5, 2005

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.