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

Re: [PATCH] Show original and resulting blob object info in diff output.

From
Linus Torvalds <torvalds@osdl.org>
Date
Oct 7, 2005, 04:47 UTC
Message-ID
<Pine.LNX.4.64.0510062139560.31407@g5.osdl.org>
In-Reply-To
<7vachm5a4w.fsf_-_@assigned-by-dhcp.cox.net>
On Thu, 6 Oct 2005, Junio C Hamano wrote:
> 
>     diff --git a/apply.c b/apply.c
>     old index 7be50413538868412a87c847f8fa184cadd0fa2a 100644
>     new index 83660822fcbb9edac523634999e30d65c2790cae 100644

Hmm.. It strikes me that if we don't have the SHA1 object, then the SHA1 is largely useless except as a verification of the thing (ie we can still _calculate_ the blob sha of whatever the current file is).

And if we _do_ have the SHA1, then we don't actually need all of it.

So the above is just very ugly, but it would be equally useful if it just had a partial SHA1 - still plenty good to identify the thing.

IO, why not make it shorter ans prettier and just make it be
	index 7be50413538868412a87..83660822fcbb9edac523
which is basically the first 20 hex digits of each SHA1.

Still plenty good to look up the object if we have it, and _certainly_ good enough as a quick verification. And much less "imposing".

The thing is, I actually tend to look at diffs when I send stuff out or receive them, and your one is just very ugly:

Show 8 quoted lines
> applies-to: 8cf0bb652ffde36e57bca5d6f33287305a61bb74
> 2c48a811a36ee6e12aeb044b3d1ff459b8d958c2
> diff --git a/apply.c b/apply.c
> old index 7be50413538868412a87c847f8fa184cadd0fa2a 100644
> new index ed2eac2c67dd003c8a0eaa7325e1543d1472777d 100644
> --- a/apply.c
> +++ b/apply.c
> @@ -14,6 +14,7 @@

That's a _lot_ of very "solid" unreadable stuff. It makes my eyes water. I'd really like to minimize it.

If you want the "applies-to" etc, then _all_ of it could be just crammed onto just one line (just cut each SHA1 down to 10 hex characters: 40 bits is still _way_ enough to indicate a unique version of a particular file if we have it, even if it's "just" a quarter of the full name. It's not like this is meant to be cryptographic. In fact, I bet 20 bits would be plenty).

		Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 15 of 17 in “Fall back to three-way merge when applying a patch.”
  1. Fall back to three-way merge when applying a patch.Junio C Hamano, Oct 5, 2005
  2. Linus TorvaldsOct 5, 2005
  3. Junio C HamanoOct 5, 2005
  4. Linus TorvaldsOct 5, 2005
  5. Junio C HamanoOct 6, 2005
  6. Eric W. BiedermanOct 6, 2005
  7. Linus TorvaldsOct 6, 2005
  8. Junio C HamanoOct 6, 2005
  9. Eric W. BiedermanOct 6, 2005
  10. Linus TorvaldsOct 6, 2005
  11. Eric W. BiedermanOct 6, 2005
  12. Linus TorvaldsOct 6, 2005
  13. Eric W. BiedermanOct 6, 2005
  14. Show original and resulting blob object info in diff output.Junio C Hamano, Oct 7, 2005
  15. Linus TorvaldsOct 7, 2005
  16. Junio C HamanoOct 7, 2005
  17. Junio C HamanoOct 6, 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.