Skip to content

Commit cebfaaa

Browse files
stepnemgitster
authored andcommitted
doc/cat-file: make synopsis and description less confusing
The DESCRIPTION's "first form" is actually the 1st, 2nd, 3rd and 5th form in SYNOPSIS, the "second form" is the 4th one. Interestingly, this state of affairs was introduced in 97fe725 (cat-file docs: fix SYNOPSIS and "-h" output, 2021-12-28) with the claim of "Now the two will match again." ("the two" being DESCRIPTION and SYNOPSIS)... The description also suffers from other correctness and clarity issues, e.g., the "first form" paragraph discusses -p, -s and -t, but leaves out -e, which is included in the corresponding SYNOPSIS section; the second paragraph mentions <format>, which doesn't occur in SYNOPSIS at all, and of the three batch options, really only describes the behavior of --batch-check. Also the mention of "drivers" seems an implementation detail not adding much clarity in a short summary (and isn't expanded upon in the rest of the man page, either). Rather than trying to maintain one-to-one (or N-to-M) correspondence between the DESCRIPTION and SYNOPSIS forms, creating duplication and providing opportunities for error, shorten the former into a concise summary describing the two general modes of operation: batch and non-batch, leaving details to the subsequent manual sections. While here, fix a grammar error in the description of -e and make the following further minor improvements: NAME: shorten ("content or type and size" isn't the whole story; say "details" and leave the actual details to later sections) SYNOPSIS and --help: move the (--textconv | --filters) form before --batch, closer to the other non-batch forms Signed-off-by: Štěpán Němec <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 43c8a30 commit cebfaaa

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

Documentation/git-cat-file.txt

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,32 @@ git-cat-file(1)
33

44
NAME
55
----
6-
git-cat-file - Provide content or type and size information for repository objects
7-
6+
git-cat-file - Provide contents or details of repository objects
87

98
SYNOPSIS
109
--------
1110
[verse]
1211
'git cat-file' <type> <object>
1312
'git cat-file' (-e | -p) <object>
1413
'git cat-file' (-t | -s) [--allow-unknown-type] <object>
14+
'git cat-file' (--textconv | --filters)
15+
[<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]
1516
'git cat-file' (--batch | --batch-check | --batch-command) [--batch-all-objects]
1617
[--buffer] [--follow-symlinks] [--unordered]
1718
[--textconv | --filters] [-Z]
18-
'git cat-file' (--textconv | --filters)
19-
[<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]
2019

2120
DESCRIPTION
2221
-----------
23-
In its first form, the command provides the content or the type of an object in
24-
the repository. The type is required unless `-t` or `-p` is used to find the
25-
object type, or `-s` is used to find the object size, or `--textconv` or
26-
`--filters` is used (which imply type "blob").
27-
28-
In the second form, a list of objects (separated by linefeeds) is provided on
29-
stdin, and the SHA-1, type, and size of each object is printed on stdout. The
30-
output format can be overridden using the optional `<format>` argument. If
31-
either `--textconv` or `--filters` was specified, the input is expected to
32-
list the object names followed by the path name, separated by a single
33-
whitespace, so that the appropriate drivers can be determined.
22+
Output the contents or other properties such as size, type or delta
23+
information of one or more objects.
24+
25+
This command can operate in two modes, depending on whether an option
26+
from the `--batch` family is specified.
27+
28+
In non-batch mode, the command provides information on an object
29+
named on the command line.
30+
31+
In batch mode, arguments are read from standard input.
3432

3533
OPTIONS
3634
-------
@@ -51,8 +49,8 @@ OPTIONS
5149

5250
-e::
5351
Exit with zero status if `<object>` exists and is a valid
54-
object. If `<object>` is of an invalid format exit with non-zero and
55-
emits an error on stderr.
52+
object. If `<object>` is of an invalid format, exit with non-zero
53+
status and emit an error on stderr.
5654

5755
-p::
5856
Pretty-print the contents of `<object>` based on its type.

builtin/cat-file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,11 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
922922
N_("git cat-file <type> <object>"),
923923
N_("git cat-file (-e | -p) <object>"),
924924
N_("git cat-file (-t | -s) [--allow-unknown-type] <object>"),
925+
N_("git cat-file (--textconv | --filters)\n"
926+
" [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"),
925927
N_("git cat-file (--batch | --batch-check | --batch-command) [--batch-all-objects]\n"
926928
" [--buffer] [--follow-symlinks] [--unordered]\n"
927929
" [--textconv | --filters] [-Z]"),
928-
N_("git cat-file (--textconv | --filters)\n"
929-
" [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"),
930930
NULL
931931
};
932932
const struct option options[] = {

0 commit comments

Comments
 (0)