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

Re: : Networking

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 26, 2005, 14:59 UTC
Message-ID
<Pine.LNX.4.58.0504260746320.18901@ppc970.osdl.org>
In-Reply-To
<20050426005725.6bfe6135.akpm@osdl.org>
On Tue, 26 Apr 2005, Andrew Morton wrote:
> 
> So I tried to apply my new get-mm-patches-from-git methodology on this and
> came unstuck.

Yes. You cannot just apply patches, since that will inevitably fail if there is any overlap. Which there quite often is.

For this to work in general, you really have to merge the different git trees, and generate patches from _that_.

> a) Set up the git repo
> 
> 	mkdir git26
> 	git init rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Yes. In the long run, you really should need to do this just once, since if there is one thing git should be good at, it's just keeping tons of random collections of objects around.

The only thing you should be a bit careful about is to remember what the "heads" at different points were. In particular, you want to remember where you merged with me last was. I've started tagging my releases with the git tag facility (_not_ the pasky one, but I think pasky will start picking up on that soon enough), so finding a specific release will be easy, but if you ever do a non-release merge you'll just have to tag it yourself.

Show 8 quoted lines
> b) Add davem's repo:
> 
> 	git addremote git-net rsync://rsync.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
> 
> c) To generate -mm's linus.patch (patch against 2.6.12-rc3):
> 
> 	git pull origin
> 	git diff -r v2.6.12-rc3 > ../25/patches/linus.patch

You should now also remember the HEAD at this point. That's your "base" for any future patches, since you expect other patches to apply on top of that.

I think cogito remembers it in the "origin" thing, but you should check.
Save it away in (for example) .git/last-diff-head:
	cat .git/HEAD > .git/last-diff-head
> d) To generate davem's tree (patch against linus's current tree (ie: patch
>    against 2.6.12-rc3+linus.patch)):
> 
> 	git pull git-net

Yes. This should have merged the two (assuming "git pull" does what I think it does).

> 	MERGE_BASE=$(merge-base $(cat .git/heads/origin ) $(cat .git/heads/git-net))
> 	git diff -r $MERGE_BASE:$(cat .git/heads/git-net) > ../25/patches/git-net.patch

No. Now you ended up looking at the last common ancestor of the thing you merged, and you _should_ have looked at what the difference was _before_ the merge.

So assuming it does remember it in "origin", you should just have done
	git diff -r $(cat .git/last-diff-head):$(cat .git/HEAD)

which basically says "diff between the tree at the time of my last diff, and the result of the merge".

Then you just update your last-diff-head to reflect that:
	cat .git/HEAD > .git/last-diff-head
and you go on:
> e) Repeat d) for all known git trees.
Yup.
				Linus
Previous: Andrew MortonNext: Daniel Barkalow
Message 2 of 13 in “Re: : Networking”
  1. Andrew MortonApr 26, 2005
  2. Linus TorvaldsApr 26, 2005
  3. Daniel BarkalowApr 26, 2005
  4. Petr BaudisApr 26, 2005
  5. Jan HarkesApr 26, 2005
  6. Petr BaudisApr 26, 2005
  7. Andrew MortonApr 26, 2005
  8. Linus TorvaldsApr 26, 2005
  9. Andrew MortonApr 26, 2005
  10. Linus TorvaldsApr 26, 2005
  11. Bram CohenApr 26, 2005
  12. Ryan AndersonApr 28, 2005
  13. Daniel BarkalowApr 28, 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.