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

Re: Cherry-pick particular object

From
Linus Torvalds <torvalds@osdl.org>
Date
Mar 28, 2006, 22:44 UTC
Message-ID
<Pine.LNX.4.64.0603281435410.15714@g5.osdl.org>
In-Reply-To
<BAYC1-PASMTP02B05019F52DE48793CB39AED30@CEZ.ICE>
On Tue, 28 Mar 2006, sean wrote:
> 
> $ git cat-file -t 78132af2643

Side note: when using git-ls-tree, the "blob"ness information is already in the tree output itself and you shouldn't even need to check the type with "-t". So what is perhaps somewhat more interesting is actually the mode of the file, since that determines whether the blob should be interpreted as regular file content or as a symlink.

Ie you can have a tree like this:
	100644 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    abc
	120000 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    file

where the first one is a regular file called "abc" (which contains the string "abc"), and the second is the _symlink_ that points to "abc".

They share the exact same blob, and what distinguishes them is the filemode info from git-read-tree.

Of course, the symlink case isn't very common and likely not very interesting in this case, but the fact that "git ls-files" is set up so that you can just cut-and-paste the "blob <sha1-of-blob" part and feed it to git-cat-file was definitely not just coincidence.

(A number of the early stuff was set up so that I could do things by hand by just doing cut-and-paste of the output of the previous command. Git has come a long way in the last 12 months ;)

		Linus
Previous: Sébastien PierreNext: Petr Baudis
Message 4 of 9 in “Cherry-pick particular object”
  1. Sébastien PierreMar 28, 2006
  2. seanMar 28, 2006
  3. Sébastien PierreMar 28, 2006
  4. Linus TorvaldsMar 28, 2006
  5. Petr BaudisMar 28, 2006
  6. Linus TorvaldsMar 28, 2006
  7. Petr BaudisMar 28, 2006
  8. Shawn PearceMar 28, 2006
  9. Tony LuckMar 28, 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.