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

Re: Creating diff from 2.6.16 from cryptodev-2.6 git tree

From
Linus Torvalds <torvalds@osdl.org>
Date
Jun 30, 2006, 02:25 UTC
Message-ID
<Pine.LNX.4.64.0606291904250.12404@g5.osdl.org>
In-Reply-To
<20060630013627.GA27527@gondor.apana.org.au>
On Fri, 30 Jun 2006, Herbert Xu wrote:
Show 14 quoted lines
>
> On Fri, Jun 30, 2006 at 01:18:24PM +1200, Michal Ludvig wrote:
> > 
> > just a quick question: how can I create a patch with all changes in
> > cryptodev-2.6 tree against tag v2.6.16 in Linus tree? I've got
> > git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
> > cloned here and want to extract all your commits in this tree since
> > 2.6.16. Is there a way to do it in Git/Cogito?
> 
> OK, it's easier if you break this into three problems.
> 
> You start by getting all the changes merged right after 2.6.16.  This
> can be done by locating the merge changeset in Linus's tree.  It looks
> like this:
Actually, there are certainly other, potentially easier, ways to do this.

It depends a bit on what Michal wants, though. Since the current trees (both mine and the cryptodev tree) have been merging things back and forth, it's _not_ as easy as just saying "pick all commits that exist in one branch but not the other", but depending on what Michal wants to do, git gives other ways to prune out just the info he wants.

The easiest by far is if you only care about a certain sub-directory. Then, assuming the branch "crypto" is the top-most commit of the cryptodev repo, just do

	git diff v2.6.16..crypto -- crypto/

and that will give you a diff of all the changes since v2.6.16 inside that subdirectory. That may or may not be sufficient and what Michal wants.

Now, the cryptodev-2.6.git tree doesn't even contain the v2.6.16 tags, but you can fix that by just doing

	git fetch --tags git://git.kernel.org//pub/scm/linux/kernel/git/torvalds/linux-2.6
even if your clone is actually from just the cryptodev-2.6 archive.
Alternatively, if you want to see the individual changes, you can just do
	git log -p --full-diff v2.6.16..crypto -- crypto/

which shows you all the commits that changed the crypto/ subdirectory, AND it shows the other changes those same commits did to other subdirectories too (which is usually something you want in a case like this).

Finally, what you can also do is that instead of matching for stuff that changed the crypto/ subdirectory, you could try to match commits where the committer is somebody special, eg Herbert Xu. We don't have that kind of thing automated, but here's one way to do it:

	git-rev-list --header v2.6.16..crypto |
		grep -z 'committer Herbert Xu' |
		tr '\0' '\n' |
		sed -n '/^[a-f0-9][a-f0-9]*$/p' |
		git diff-tree --pretty -p --stdin |
		less -S

where the "git-rev-list --header | grep -z" part picks out any commits committed by Herbert, the "tr '\0' '\n' | sed -n" part then picks up just the commit ID's from those lines, and the "git-diff-tree" part then shows those commits as diffs.

(The above should really be quite possible to shorten as
	git log -p --committer="Herbert Xu"

but we don't actually support git-rev-list doing matching on committer/author names - although it should be easy to do in case somebody wants to have a small git project to get their toes wet, hint hint)

			Linus
Previous: Herbert XuNext: Herbert Xu
Message 3 of 9 in “Creating diff from 2.6.16 from cryptodev-2.6 git tree”
  1. Michal LudvigJun 30, 2006
  2. Herbert XuJun 30, 2006
  3. Linus TorvaldsJun 30, 2006
  4. Herbert XuJun 30, 2006
  5. Linus TorvaldsJun 30, 2006
  6. Michal LudvigJun 30, 2006
  7. Michal LudvigJun 30, 2006
  8. Linus TorvaldsJun 30, 2006
  9. Junio C HamanoJun 30, 2006

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.