Merge branch 'jc/usage-stdin'

The synopsis text and the usage string of subcommands that read
list of things from the standard input are often shown as if they
only take input from a file on a filesystem, which was misleading.

* jc/usage-stdin:
  usage: do not insist that standard input must come from a file
This commit is contained in:
Junio C Hamano 2015-10-26 15:55:17 -07:00
commit 97a9e546a2
25 changed files with 64 additions and 41 deletions

View File

@ -10,7 +10,7 @@ SYNOPSIS
-------- --------
[verse] [verse]
'git cat-file' (-t [--allow-unknown-type]| -s [--allow-unknown-type]| -e | -p | <type> | --textconv ) <object> 'git cat-file' (-t [--allow-unknown-type]| -s [--allow-unknown-type]| -e | -p | <type> | --textconv ) <object>
'git cat-file' (--batch | --batch-check) [--follow-symlinks] < <list-of-objects> 'git cat-file' (--batch | --batch-check) [--follow-symlinks]
DESCRIPTION DESCRIPTION
----------- -----------

View File

@ -10,7 +10,7 @@ SYNOPSIS
-------- --------
[verse] [verse]
'git check-attr' [-a | --all | attr...] [--] pathname... 'git check-attr' [-a | --all | attr...] [--] pathname...
'git check-attr' --stdin [-z] [-a | --all | attr...] < <list-of-paths> 'git check-attr' --stdin [-z] [-a | --all | attr...]
DESCRIPTION DESCRIPTION
----------- -----------
@ -28,7 +28,8 @@ OPTIONS
Consider `.gitattributes` in the index only, ignoring the working tree. Consider `.gitattributes` in the index only, ignoring the working tree.
--stdin:: --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:: -z::
The output format is modified to be machine-parseable. The output format is modified to be machine-parseable.

View File

@ -10,7 +10,7 @@ SYNOPSIS
-------- --------
[verse] [verse]
'git check-ignore' [options] pathname... 'git check-ignore' [options] pathname...
'git check-ignore' [options] --stdin < <list-of-paths> 'git check-ignore' [options] --stdin
DESCRIPTION DESCRIPTION
----------- -----------
@ -35,7 +35,8 @@ OPTIONS
for each given pathname. for each given pathname.
--stdin:: --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:: -z::
The output format is modified to be machine-parseable (see The output format is modified to be machine-parseable (see

View File

@ -9,7 +9,7 @@ git-commit-tree - Create a new commit object
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git commit-tree' <tree> [(-p <parent>)...] < changelog 'git commit-tree' <tree> [(-p <parent>)...]
'git commit-tree' [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] 'git commit-tree' [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]
[(-F <file>)...] <tree> [(-F <file>)...] <tree>

View File

@ -9,7 +9,7 @@ git-fmt-merge-msg - Produce a merge commit message
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git fmt-merge-msg' [-m <message>] [--log[=<n>] | --no-log] <$GIT_DIR/FETCH_HEAD 'git fmt-merge-msg' [-m <message>] [--log[=<n>] | --no-log]
'git fmt-merge-msg' [-m <message>] [--log[=<n>] | --no-log] -F <file> 'git fmt-merge-msg' [-m <message>] [--log[=<n>] | --no-log] -F <file>
DESCRIPTION DESCRIPTION
@ -57,6 +57,18 @@ merge.summary::
Synonym to `merge.log`; this is deprecated and will be removed in Synonym to `merge.log`; this is deprecated and will be removed in
the future. 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 SEE ALSO
-------- --------
linkgit:git-merge[1] linkgit:git-merge[1]

View File

@ -9,17 +9,19 @@ git-get-tar-commit-id - Extract commit ID from an archive created using git-arch
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git get-tar-commit-id' < <tarfile> 'git get-tar-commit-id'
DESCRIPTION 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 Read a tar archive created by 'git archive' from the standard input
runtime is not influenced by the size of <tarfile> very much. 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 If no commit ID is found, 'git get-tar-commit-id' quietly exists with a
return code of 1. This can happen if <tarfile> 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 using 'git archive' or if the first parameter of 'git archive' had been
a tree ID instead of a commit ID or tag. a tree ID instead of a commit ID or tag.

View File

@ -10,7 +10,7 @@ SYNOPSIS
-------- --------
[verse] [verse]
'git hash-object' [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin [--literally]] [--] <file>... 'git hash-object' [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin [--literally]] [--] <file>...
'git hash-object' [-t <type>] [-w] --stdin-paths [--no-filters] < <list-of-paths> 'git hash-object' [-t <type>] [-w] --stdin-paths [--no-filters]
DESCRIPTION DESCRIPTION
----------- -----------
@ -35,7 +35,8 @@ OPTIONS
Read the object from standard input instead of from a file. Read the object from standard input instead of from a file.
--stdin-paths:: --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:: --path::
Hash object as it were located at the given path. The location of Hash object as it were located at the given path. The location of

View File

@ -9,7 +9,7 @@ git-mktag - Creates a tag object
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git mktag' < signature_file 'git mktag'
DESCRIPTION DESCRIPTION
----------- -----------
@ -20,7 +20,8 @@ The output is the new tag's <object> identifier.
Tag Format 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 <sha1> object <sha1>
type <typename> type <typename>

View File

@ -8,10 +8,12 @@ git-patch-id - Compute unique ID for a patch
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git patch-id' [--stable | --unstable] < <patch> 'git patch-id' [--stable | --unstable]
DESCRIPTION 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 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 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 stable", but at the same time also reasonably unique, i.e., two patches that

View File

@ -9,13 +9,14 @@ git-show-index - Show packed archive index
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git show-index' < idx-file 'git show-index'
DESCRIPTION DESCRIPTION
----------- -----------
Reads given idx file for packed Git archive created with Read the idx file for a Git packfile created with
'git pack-objects' command, and dumps its contents. 'git pack-objects' command from the standard input, and
dump its contents.
The information it outputs is subset of what you can get from The information it outputs is subset of what you can get from
'git verify-pack -v'; this command only shows the packfile 'git verify-pack -v'; this command only shows the packfile

View File

@ -11,7 +11,7 @@ SYNOPSIS
'git show-ref' [-q|--quiet] [--verify] [--head] [-d|--dereference] 'git show-ref' [-q|--quiet] [--verify] [--head] [-d|--dereference]
[-s|--hash[=<n>]] [--abbrev[=<n>]] [--tags] [-s|--hash[=<n>]] [--abbrev[=<n>]] [--tags]
[--heads] [--] [<pattern>...] [--heads] [--] [<pattern>...]
'git show-ref' --exclude-existing[=<pattern>] < ref-list 'git show-ref' --exclude-existing[=<pattern>]
DESCRIPTION DESCRIPTION
----------- -----------
@ -23,8 +23,9 @@ particular ref exists.
By default, shows the tags, heads, and remote refs. By default, shows the tags, heads, and remote refs.
The --exclude-existing form is a filter that does the inverse, it shows the The --exclude-existing form is a filter that does the inverse. It reads
refs from stdin that don't exist in the local repository. 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 Use of this utility is encouraged in favor of directly accessing files under
the `.git` directory. the `.git` directory.

View File

@ -9,14 +9,15 @@ git-stripspace - Remove unnecessary whitespace
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git stripspace' [-s | --strip-comments] < input 'git stripspace' [-s | --strip-comments]
'git stripspace' [-c | --comment-lines] < input 'git stripspace' [-c | --comment-lines]
DESCRIPTION DESCRIPTION
----------- -----------
Clean the input in the manner used by Git for text such as commit Read text, such as commit messages, notes, tags and branch
messages, notes, tags and branch descriptions. descriptions, from the standard input and clean it in the manner
used by Git.
With no arguments, this will: With no arguments, this will:

View File

@ -9,7 +9,7 @@ git-unpack-objects - Unpack objects from a packed archive
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git unpack-objects' [-n] [-q] [-r] [--strict] < <packfile> 'git unpack-objects' [-n] [-q] [-r] [--strict]
DESCRIPTION DESCRIPTION

View File

@ -426,7 +426,7 @@ static int batch_objects(struct batch_options *opt)
static const char * const cat_file_usage[] = { static const char * const cat_file_usage[] = {
N_("git cat-file (-t [--allow-unknown-type]|-s [--allow-unknown-type]|-e|-p|<type>|--textconv) <object>"), N_("git cat-file (-t [--allow-unknown-type]|-s [--allow-unknown-type]|-e|-p|<type>|--textconv) <object>"),
N_("git cat-file (--batch | --batch-check) [--follow-symlinks] < <list-of-objects>"), N_("git cat-file (--batch | --batch-check) [--follow-symlinks]"),
NULL NULL
}; };

View File

@ -9,7 +9,7 @@ static int cached_attrs;
static int stdin_paths; static int stdin_paths;
static const char * const check_attr_usage[] = { static const char * const check_attr_usage[] = {
N_("git check-attr [-a | --all | <attr>...] [--] <pathname>..."), N_("git check-attr [-a | --all | <attr>...] [--] <pathname>..."),
N_("git check-attr --stdin [-z] [-a | --all | <attr>...] < <list-of-paths>"), N_("git check-attr --stdin [-z] [-a | --all | <attr>...]"),
NULL NULL
}; };

View File

@ -8,7 +8,7 @@
static int quiet, verbose, stdin_paths, show_non_matching, no_index; static int quiet, verbose, stdin_paths, show_non_matching, no_index;
static const char * const check_ignore_usage[] = { static const char * const check_ignore_usage[] = {
"git check-ignore [<options>] <pathname>...", "git check-ignore [<options>] <pathname>...",
"git check-ignore [<options>] --stdin < <list-of-paths>", "git check-ignore [<options>] --stdin",
NULL NULL
}; };

View File

@ -10,7 +10,7 @@
#include "utf8.h" #include "utf8.h"
#include "gpg-interface.h" #include "gpg-interface.h"
static const char commit_tree_usage[] = "git commit-tree [(-p <sha1>)...] [-S[<keyid>]] [-m <message>] [-F <file>] <sha1> <changelog"; static const char commit_tree_usage[] = "git commit-tree [(-p <sha1>)...] [-S[<keyid>]] [-m <message>] [-F <file>] <sha1>";
static const char *sign_commit; static const char *sign_commit;

View File

@ -8,7 +8,7 @@
#include "quote.h" #include "quote.h"
static const char builtin_get_tar_commit_id_usage[] = static const char builtin_get_tar_commit_id_usage[] =
"git get-tar-commit-id < <tarfile>"; "git get-tar-commit-id";
/* ustar header + extended global header content */ /* ustar header + extended global header content */
#define RECORDSIZE (512) #define RECORDSIZE (512)

View File

@ -78,7 +78,7 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix)
{ {
static const char * const hash_object_usage[] = { static const char * const hash_object_usage[] = {
N_("git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] [--] <file>..."), N_("git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] [--] <file>..."),
N_("git hash-object --stdin-paths < <list-of-paths>"), N_("git hash-object --stdin-paths"),
NULL NULL
}; };
const char *type = blob_type; const char *type = blob_type;

View File

@ -154,7 +154,7 @@ int cmd_mktag(int argc, const char **argv, const char *prefix)
unsigned char result_sha1[20]; unsigned char result_sha1[20];
if (argc != 1) if (argc != 1)
usage("git mktag < signaturefile"); usage("git mktag");
if (strbuf_read(&buf, 0, 4096) < 0) { if (strbuf_read(&buf, 0, 4096) < 0) {
die_errno("could not read from stdin"); die_errno("could not read from stdin");

View File

@ -165,7 +165,7 @@ static void generate_id_list(int stable)
strbuf_release(&line_buf); strbuf_release(&line_buf);
} }
static const char patch_id_usage[] = "git patch-id [--stable | --unstable] < patch"; static const char patch_id_usage[] = "git patch-id [--stable | --unstable]";
static int git_patch_id_config(const char *var, const char *value, void *cb) static int git_patch_id_config(const char *var, const char *value, void *cb)
{ {

View File

@ -8,7 +8,7 @@
static const char * const show_ref_usage[] = { static const char * const show_ref_usage[] = {
N_("git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"), N_("git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"),
N_("git show-ref --exclude-existing[=<pattern>] < <ref-list>"), N_("git show-ref --exclude-existing[=<pattern>]"),
NULL NULL
}; };

View File

@ -78,8 +78,8 @@ static void comment_lines(struct strbuf *buf)
} }
static const char *usage_msg = "\n" static const char *usage_msg = "\n"
" git stripspace [-s | --strip-comments] < input\n" " git stripspace [-s | --strip-comments]\n"
" git stripspace [-c | --comment-lines] < input"; " git stripspace [-c | --comment-lines]";
int cmd_stripspace(int argc, const char **argv, const char *prefix) int cmd_stripspace(int argc, const char **argv, const char *prefix)
{ {

View File

@ -13,7 +13,7 @@
#include "fsck.h" #include "fsck.h"
static int dry_run, quiet, recover, has_errors, strict; static int dry_run, quiet, recover, has_errors, strict;
static const char unpack_usage[] = "git unpack-objects [-n] [-q] [-r] [--strict] < pack-file"; static const char unpack_usage[] = "git unpack-objects [-n] [-q] [-r] [--strict]";
/* We always read in 4kB chunks. */ /* We always read in 4kB chunks. */
static unsigned char buffer[4096]; static unsigned char buffer[4096];

View File

@ -2,7 +2,7 @@
#include "pack.h" #include "pack.h"
static const char show_index_usage[] = static const char show_index_usage[] =
"git show-index < <packed archive index>"; "git show-index";
int main(int argc, char **argv) int main(int argc, char **argv)
{ {