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

Re: Commit SHA1 == SHA1 checksum?

From
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Date
Feb 7, 2022, 21:34 UTC
Message-ID
<20220207213449.ljqjhdx4f45a3lx5@meerkat.local>
In-Reply-To
<xmqqczjyiecs.fsf@gitster.g>
On Mon, Feb 07, 2022 at 12:57:55PM -0800, Junio C Hamano wrote:
Show 5 quoted lines
> You are solving a different problem: "I have this tar archive; what
> git tree object would I get if I extract this archive to an empty
> directory and said 'git add . && git write-tree'?".
> 
> I agree that one is computable.

So, I was brainstorming about this today, and I'm curious if you think this would be a useful feature to have, maybe even natively?

E.g. here's a scenario:

"git archive -S <signed-object>" creates an additional file that is added to the generated tar/zip archive -- for example, a ${prefix}.GIT_ARCHIVE_SIG. That file contains the raw contents of the signed tag and/or the signed commit.

"git verify-archive" would look for a toplevel .GIT_ARCHIVE_SIG file. If it's present, it would verify the signature on these "detached" signed objects to get a trusted tree hash. Then it would compute the tree hash of the tar archive (minus the .GIT_ARCHIVE_SIG file) to see if it matches.

In my mind, that would provide the following benefits over the current practice of detached .sig files:

1. environments like github/git.kernel.org would be able to create verifiable
   snapshot archives using an existing set of signed objects
2. packagers would be able to perform cryptographic verification without
   needing to track any extra sources like corresponding .sig files; they
   would just need to add a build-time dependency on git (plus whatever it
   calls for cryptographic verification, such as gnupg or openssh)
3. this would automatically support all git-native signature mechanisms like
   openssh and whatever else gets added in the future
Does this idea have any merit, or is it too fragile/crazy to bother?
> Of course, even that reverse problem will break once we consider the
> release tarball generation procedure where we _add_ some generated
> files that are not in the Git tree, for builder's convenience.

Yes, but it's increasingly rare and many build instructions now specifically allow for things like "first, run autoconf if you don't already have a configure file", etc.

-K
Previous: Junio C HamanoNext: Gamblin, Todd
Message 14 of 19 in “Commit SHA1 == SHA1 checksum?”
  1. Gamblin, ToddFeb 5, 2022
  2. Philip OakleyFeb 6, 2022
  3. Gamblin, ToddFeb 6, 2022
  4. Johannes SixtFeb 6, 2022
  5. Junio C HamanoFeb 6, 2022
  6. Philip OakleyFeb 6, 2022
  7. Junio C HamanoFeb 6, 2022
  8. Philip OakleyFeb 6, 2022
  9. Gamblin, ToddFeb 7, 2022
  10. Konstantin RyabitsevFeb 7, 2022
  11. Gamblin, ToddFeb 7, 2022
  12. Konstantin RyabitsevFeb 7, 2022
  13. Junio C HamanoFeb 7, 2022
  14. Konstantin RyabitsevFeb 7, 2022
  15. Gamblin, ToddFeb 7, 2022
  16. Konstantin RyabitsevFeb 7, 2022
  17. Gamblin, ToddFeb 8, 2022
  18. Junio C HamanoFeb 7, 2022
  19. Konstantin RyabitsevFeb 7, 2022

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.