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

Re: [RFC] get_sha1() shorthands for blob/tree objects

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 19, 2006, 01:16 UTC
Message-ID
<Pine.LNX.4.64.0604181805080.3701@g5.osdl.org>
In-Reply-To
<7vpsjecriu.fsf@assigned-by-dhcp.cox.net>
On Tue, 18 Apr 2006, Junio C Hamano wrote:
Show 8 quoted lines
> Linus Torvalds <torvalds@osdl.org> writes:
> 
> > 	git diff v0.99.6:git-commit-script..v1.3.0:git-commit.sh
> 
> This is interesting.
> 
> Yet to be born "internal diff".  Should I start one, or are you
> already hacking on it?

I'm not working on it, but I might get back to it if nobody else beats me to it.

Probably not in the next few days, though, so if you feel the urge, please do look into it.

Anyway, the above syntax would actually work even with the current external diff, because with my suggested patch we get:

  git-rev-parse v0.99.6:git-commit-script..v1.3.0:git-commit.sh
resulting in
	01c73bdd08e075d650e58664650bcd7fe1cd1551
	^a2455b0f8ff1582248b0678b9c85b2f064d972c4

(which are just the SHA1's for the object), and then the external diff will just see that it's two commits, so it decides to just feed them directly into git-diff-tree.

So if we added the test for "are the objects two commits" to git-diff-tree and diffed them directly, it would all "just work".

But you're certainly correct in stating that it would be _cleaner_ to do it with a internal "git diff" command. Everything should be perfectly set up by just calling the regular "setup_revisions()", and looking at the "rev.pending_objects" list.

Now, the thing that an internal "git diff" could do better is to notice when it gets _one_ blob revision, and one filename, ie we could do

	git diff v0.99.6:git-commit-script git-commit.sh

which parses as one SHA1 of a blob (put onto the rev.pending_objects list), and one filename (in the rev.prune_data array). We could decide to automatically do the "right thing" for that case too.

		Linus
Previous: Junio C HamanoNext: Linus Torvalds
Message 11 of 24 in “[RFC] get_sha1() shorthands for blob/tree objects”
  1. Linus TorvaldsApr 18, 2006
  2. Martin LanghoffApr 19, 2006
  3. Shawn PearceApr 19, 2006
  4. Ray LehtiniemiApr 19, 2006
  5. Junio C HamanoApr 19, 2006
  6. Linus TorvaldsApr 19, 2006
  7. Linus TorvaldsApr 19, 2006
  8. Andreas EricssonApr 19, 2006
  9. Linus TorvaldsApr 19, 2006
  10. Junio C HamanoApr 19, 2006
  11. Linus TorvaldsApr 19, 2006
  12. Linus TorvaldsApr 19, 2006
  13. Junio C HamanoApr 19, 2006
  14. Linus TorvaldsApr 19, 2006
  15. Junio C HamanoApr 19, 2006
  16. Linus TorvaldsApr 19, 2006
  17. Junio C HamanoApr 19, 2006
  18. Linus TorvaldsApr 19, 2006
  19. Martin LanghoffApr 19, 2006
  20. Linus TorvaldsApr 19, 2006
  21. Linus TorvaldsApr 19, 2006
  22. [RFC] get_sha1(): :path and :[0-3]:path to extract from index.Junio C Hamano, Apr 22, 2006
  23. Uwe ZeisbergerApr 25, 2006
  24. Junio C HamanoApr 25, 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.