diff options
| author | Victoria Dye <vdye@github.com> | 2025-06-02 18:55:55 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-06-03 12:08:58 -0700 |
| commit | b0b910e052b2c5a8036343c0475dbbb01add6be8 (patch) | |
| tree | b97adf8e2a2e2da7f860278dd35501523e415913 /Documentation | |
| parent | cat-file: add %(objectmode) atom (diff) | |
| download | git-b0b910e052b2c5a8036343c0475dbbb01add6be8.tar.gz git-b0b910e052b2c5a8036343c0475dbbb01add6be8.zip | |
cat-file.c: add batch handling for submodules
When an object specification is passed to 'cat-file --batch[-check]'
referring to a submodule (e.g. 'HEAD:path/to/my/submodule'), the current
behavior of the command is to print the "missing" error message. However, it
is often valuable for callers to distinguish between paths that are actually
missing and "the submodule tree entry exists, but the object does not exist
in the repository".
To disambiguate without needing to invoke a separate Git process (e.g.
'ls-tree'), print the message "<oid> submodule" for such objects instead of
"<object> missing". In addition to the change from "missing" to "submodule",
the new message differs from the old in that it always prints the resolved
tree entry's OID, rather than the input object specification.
Note that this implementation maintains a distinction between submodules
where the commit OID is not present in the repo, and submodules where the
commit OID *is* present; the former will now print "<object> submodule", but
the latter will still print the full object content.
Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
| -rw-r--r-- | Documentation/git-cat-file.adoc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Documentation/git-cat-file.adoc b/Documentation/git-cat-file.adoc index 5c002c0499..180d1ad363 100644 --- a/Documentation/git-cat-file.adoc +++ b/Documentation/git-cat-file.adoc @@ -373,6 +373,14 @@ If a name is specified that might refer to more than one object (an ambiguous sh <object> SP ambiguous LF ------------ +If a name is specified that refers to a submodule entry in a tree and the +target object does not exist in the repository, then `cat-file` will ignore +any custom format and print (with the object ID of the submodule): + +------------ +<oid> SP submodule LF +------------ + If `--follow-symlinks` is used, and a symlink in the repository points outside the repository, then `cat-file` will ignore any custom format and print: |
