From 33e8fc87407505c3a96792fc47189d57b97b34c3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 16 Oct 2015 11:27:42 -0700 Subject: usage: do not insist that standard input must come from a file The synopsys text and the usage string of subcommands that read list of things from the standard input are often shown like this: git gostak [--distim] < This is problematic in a number of ways: * The way to use these commands is more often to feed them the output from another command, not feed them from a file. * Manual pages outside Git, commands that operate on the data read from the standard input, e.g "sort", "grep", "sed", etc., are not described with such a "< redirection-from-file" in their synopsys text. Our doing so introduces inconsistency. * We do not insist on where the output should go, by saying git gostak [--distim] < > * As it is our convention to enclose placeholders inside , the redirection operator followed by a placeholder filename becomes very hard to read, both in the documentation and in the help text. Let's clean them all up, after making sure that the documentation clearly describes the modes that take information from the standard input and what kind of things are expected on the input. [jc: stole example for fmt-merge-msg from Jonathan] Helped-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/git-cat-file.txt | 2 +- Documentation/git-check-attr.txt | 5 +++-- Documentation/git-check-ignore.txt | 5 +++-- Documentation/git-commit-tree.txt | 2 +- Documentation/git-fmt-merge-msg.txt | 14 +++++++++++++- Documentation/git-get-tar-commit-id.txt | 12 +++++++----- Documentation/git-hash-object.txt | 5 +++-- Documentation/git-mktag.txt | 5 +++-- Documentation/git-patch-id.txt | 4 +++- Documentation/git-show-index.txt | 7 ++++--- Documentation/git-show-ref.txt | 7 ++++--- Documentation/git-stripspace.txt | 9 +++++---- Documentation/git-unpack-objects.txt | 2 +- 13 files changed, 51 insertions(+), 28 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt index 3105fc0720..eb3d6945a9 100644 --- a/Documentation/git-cat-file.txt +++ b/Documentation/git-cat-file.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] 'git cat-file' (-t [--allow-unknown-type]| -s [--allow-unknown-type]| -e | -p | | --textconv ) -'git cat-file' (--batch | --batch-check) [--follow-symlinks] < +'git cat-file' (--batch | --batch-check) [--follow-symlinks] DESCRIPTION ----------- diff --git a/Documentation/git-check-attr.txt b/Documentation/git-check-attr.txt index 00e2aa2df2..aa3b2bf2fc 100644 --- a/Documentation/git-check-attr.txt +++ b/Documentation/git-check-attr.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] 'git check-attr' [-a | --all | attr...] [--] pathname... -'git check-attr' --stdin [-z] [-a | --all | attr...] < +'git check-attr' --stdin [-z] [-a | --all | attr...] DESCRIPTION ----------- @@ -28,7 +28,8 @@ OPTIONS Consider `.gitattributes` in the index only, ignoring the working tree. --stdin:: - Read file names from stdin instead of from the command-line. + Read pathnames from the standard input, one per line, + instead of from the command-line. -z:: The output format is modified to be machine-parseable. diff --git a/Documentation/git-check-ignore.txt b/Documentation/git-check-ignore.txt index e35cd0489b..59531abba4 100644 --- a/Documentation/git-check-ignore.txt +++ b/Documentation/git-check-ignore.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] 'git check-ignore' [options] pathname... -'git check-ignore' [options] --stdin < +'git check-ignore' [options] --stdin DESCRIPTION ----------- @@ -35,7 +35,8 @@ OPTIONS for each given pathname. --stdin:: - Read file names from stdin instead of from the command-line. + Read pathnames from the standard input, one per line, + instead of from the command-line. -z:: The output format is modified to be machine-parseable (see diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt index a0b5457304..48c33d7ed7 100644 --- a/Documentation/git-commit-tree.txt +++ b/Documentation/git-commit-tree.txt @@ -9,7 +9,7 @@ git-commit-tree - Create a new commit object SYNOPSIS -------- [verse] -'git commit-tree' [(-p )...] < changelog +'git commit-tree' [(-p )...] 'git commit-tree' [(-p )...] [-S[]] [(-m )...] [(-F )...] diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt index 55a9a4b93a..6526b178e8 100644 --- a/Documentation/git-fmt-merge-msg.txt +++ b/Documentation/git-fmt-merge-msg.txt @@ -9,7 +9,7 @@ git-fmt-merge-msg - Produce a merge commit message SYNOPSIS -------- [verse] -'git fmt-merge-msg' [-m ] [--log[=] | --no-log] <$GIT_DIR/FETCH_HEAD +'git fmt-merge-msg' [-m ] [--log[=] | --no-log] 'git fmt-merge-msg' [-m ] [--log[=] | --no-log] -F DESCRIPTION @@ -57,6 +57,18 @@ merge.summary:: Synonym to `merge.log`; this is deprecated and will be removed in the future. +EXAMPLE +------- + +-- +$ git fetch origin master +$ git fmt-merge-msg --log <$GIT_DIR/FETCH_HEAD +-- + +Print a log message describing a merge of the "master" branch from +the "origin" remote. + + SEE ALSO -------- linkgit:git-merge[1] diff --git a/Documentation/git-get-tar-commit-id.txt b/Documentation/git-get-tar-commit-id.txt index 1e2a20dd26..ac44d85b0b 100644 --- a/Documentation/git-get-tar-commit-id.txt +++ b/Documentation/git-get-tar-commit-id.txt @@ -9,17 +9,19 @@ git-get-tar-commit-id - Extract commit ID from an archive created using git-arch SYNOPSIS -------- [verse] -'git get-tar-commit-id' < +'git get-tar-commit-id' DESCRIPTION ----------- -Acts as a filter, extracting the commit ID stored in archives created by -'git archive'. It reads only the first 1024 bytes of input, thus its -runtime is not influenced by the size of very much. + +Read a tar archive created by 'git archive' from the standard input +and extract the commit ID stored in it. It reads only the first +1024 bytes of input, thus its runtime is not influenced by the size +of the tar archive very much. If no commit ID is found, 'git get-tar-commit-id' quietly exists with a -return code of 1. This can happen if had not been created +return code of 1. This can happen if the archive had not been created using 'git archive' or if the first parameter of 'git archive' had been a tree ID instead of a commit ID or tag. diff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt index 0c75f3b610..814e74406a 100644 --- a/Documentation/git-hash-object.txt +++ b/Documentation/git-hash-object.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] 'git hash-object' [-t ] [-w] [--path=|--no-filters] [--stdin [--literally]] [--] ... -'git hash-object' [-t ] [-w] --stdin-paths [--no-filters] < +'git hash-object' [-t ] [-w] --stdin-paths [--no-filters] DESCRIPTION ----------- @@ -35,7 +35,8 @@ OPTIONS Read the object from standard input instead of from a file. --stdin-paths:: - Read file names from stdin instead of from the command-line. + Read file names from the standard input, one per line, instead + of from the command-line. --path:: Hash object as it were located at the given path. The location of diff --git a/Documentation/git-mktag.txt b/Documentation/git-mktag.txt index 3ca158b05e..fa6a756123 100644 --- a/Documentation/git-mktag.txt +++ b/Documentation/git-mktag.txt @@ -9,7 +9,7 @@ git-mktag - Creates a tag object SYNOPSIS -------- [verse] -'git mktag' < signature_file +'git mktag' DESCRIPTION ----------- @@ -20,7 +20,8 @@ The output is the new tag's identifier. Tag Format ---------- -A tag signature file has a very simple fixed format: four lines of +A tag signature file, to be fed to this command's standard input, +has a very simple fixed format: four lines of object type diff --git a/Documentation/git-patch-id.txt b/Documentation/git-patch-id.txt index 31efc587ee..cf71fba1c0 100644 --- a/Documentation/git-patch-id.txt +++ b/Documentation/git-patch-id.txt @@ -8,10 +8,12 @@ git-patch-id - Compute unique ID for a patch SYNOPSIS -------- [verse] -'git patch-id' [--stable | --unstable] < +'git patch-id' [--stable | --unstable] DESCRIPTION ----------- +Read a patch from the standard input and compute the patch ID for it. + A "patch ID" is nothing but a sum of SHA-1 of the file diffs associated with a patch, with whitespace and line numbers ignored. As such, it's "reasonably stable", but at the same time also reasonably unique, i.e., two patches that diff --git a/Documentation/git-show-index.txt b/Documentation/git-show-index.txt index fbdc8adae5..a8a9509e0e 100644 --- a/Documentation/git-show-index.txt +++ b/Documentation/git-show-index.txt @@ -9,13 +9,14 @@ git-show-index - Show packed archive index SYNOPSIS -------- [verse] -'git show-index' < idx-file +'git show-index' DESCRIPTION ----------- -Reads given idx file for packed Git archive created with -'git pack-objects' command, and dumps its contents. +Read the idx file for a Git packfile created with +'git pack-objects' command from the standard input, and +dump its contents. The information it outputs is subset of what you can get from 'git verify-pack -v'; this command only shows the packfile diff --git a/Documentation/git-show-ref.txt b/Documentation/git-show-ref.txt index 2a6f89b235..3a32451984 100644 --- a/Documentation/git-show-ref.txt +++ b/Documentation/git-show-ref.txt @@ -11,7 +11,7 @@ SYNOPSIS 'git show-ref' [-q|--quiet] [--verify] [--head] [-d|--dereference] [-s|--hash[=]] [--abbrev[=]] [--tags] [--heads] [--] [...] -'git show-ref' --exclude-existing[=] < ref-list +'git show-ref' --exclude-existing[=] DESCRIPTION ----------- @@ -23,8 +23,9 @@ particular ref exists. By default, shows the tags, heads, and remote refs. -The --exclude-existing form is a filter that does the inverse, it shows the -refs from stdin that don't exist in the local repository. +The --exclude-existing form is a filter that does the inverse. It reads +refs from stdin, one ref per line, and shows those that don't exist in +the local repository. Use of this utility is encouraged in favor of directly accessing files under the `.git` directory. diff --git a/Documentation/git-stripspace.txt b/Documentation/git-stripspace.txt index 60328d5d08..2438f76da0 100644 --- a/Documentation/git-stripspace.txt +++ b/Documentation/git-stripspace.txt @@ -9,14 +9,15 @@ git-stripspace - Remove unnecessary whitespace SYNOPSIS -------- [verse] -'git stripspace' [-s | --strip-comments] < input -'git stripspace' [-c | --comment-lines] < input +'git stripspace' [-s | --strip-comments] +'git stripspace' [-c | --comment-lines] DESCRIPTION ----------- -Clean the input in the manner used by Git for text such as commit -messages, notes, tags and branch descriptions. +Read text, such as commit messages, notes, tags and branch +descriptions, from the standard input and clean it in the manner +used by Git. With no arguments, this will: diff --git a/Documentation/git-unpack-objects.txt b/Documentation/git-unpack-objects.txt index 07d432988f..3e887d1610 100644 --- a/Documentation/git-unpack-objects.txt +++ b/Documentation/git-unpack-objects.txt @@ -9,7 +9,7 @@ git-unpack-objects - Unpack objects from a packed archive SYNOPSIS -------- [verse] -'git unpack-objects' [-n] [-q] [-r] [--strict] < +'git unpack-objects' [-n] [-q] [-r] [--strict] DESCRIPTION -- cgit v1.2.3