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

Re: [PATCH 3/3] cat-file: avoid verifying submodules' OIDs

From
Jeff King <peff@peff.net>
Date
Mar 12, 2024, 08:58 UTC
Message-ID
<20240312085854.GA94437@coredump.intra.peff.net>
In-Reply-To
<951f73397c15f76da75bbd74a02f36da0116623f.1710183362.git.gitgitgadget@gmail.com>
On Mon, Mar 11, 2024 at 06:56:02PM +0000, Johannes Schindelin via GitGitGadget wrote:
Show 12 quoted lines
> diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
> index de29e6d79d9..69b50d2042f 100644
> --- a/Documentation/git-cat-file.txt
> +++ b/Documentation/git-cat-file.txt
> @@ -412,6 +412,11 @@ Note also that multiple copies of an object may be present in the object
>  database; in this case, it is undefined which copy's size or delta base
>  will be reported.
>  
> +Submodules are handled specially in `git cat-file`, as the objects
> +corresponding to the recorded OIDs are not expected to be present in the
> +current repository. For that reason, submodules are reported as having
> +type `submodule` and mode 1600000 and all other fields are zeroed out.
I think there's an extra 0 in the mode here?

It may also be worth being more explicit about when Git knows something is a submodule. Naively, reading the above I might think that:

  git ls-tree --format='%(objectname)' HEAD | git cat-file --batch-check

would do something special with submodules. But it can't, as there's no context carried in just the objectname. This is obvious if you are familiar with how Git works, but I'm not sure it would be for all end users. So we could say something along the lines of:

  When `cat-file` is given a name within a tree that points to a
  submodule (e.g., `HEAD:my-submodule`), ...
-Peff
Previous: Johannes Schindelin via GitGitGadgetNext: Junio C Hamano
Message 8 of 15 in “cat-file: add %(objectmode) avoid verifying submodules' OIDs”
  1. 0/3 cat-file: add %(objectmode) avoid verifying submodules' OIDsJohannes Schindelin via GitGitGadget, Mar 11, 2024
  2. 1/3 t1006: update 'run_tests' to test generic object specifiersVictoria Dye via GitGitGadget, Mar 11, 2024
  3. Junio C HamanoMar 11, 2024
  4. 2/3 cat-file: add %(objectmode) atomVictoria Dye via GitGitGadget, Mar 11, 2024
  5. Junio C HamanoMar 11, 2024
  6. Junio C HamanoMar 13, 2024
  7. 3/3 cat-file: avoid verifying submodules' OIDsJohannes Schindelin via GitGitGadget, Mar 11, 2024
  8. Jeff KingMar 12, 2024
  9. Junio C HamanoMar 12, 2024
  10. Jeff KingMar 12, 2024
  11. Junio C HamanoMar 13, 2024
  12. Junio C HamanoMar 11, 2024
  13. Jeff KingMar 12, 2024
  14. Junio C HamanoMar 12, 2024
  15. Jeff KingMar 12, 2024

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.