Skip to content

Commit 05d3951

Browse files
dmpotgitster
authored andcommitted
git-archive: add '-o' as a alias for '--output'
The '-o' option is commonly used in many tools to specify the output file. Typing '--output' every time is a bit too long to be a practical alternative to redirecting output. But specifying the output name has the advantage of making possible to guess the desired output format by filename extension. Signed-off-by: Dmitry Potapov <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 98df233 commit 05d3951

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Documentation/git-archive.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SYNOPSIS
1010
--------
1111
[verse]
1212
'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
13-
[--output=<file>] [--worktree-attributes]
13+
[-o | --output=<file>] [--worktree-attributes]
1414
[--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
1515
[path...]
1616

@@ -48,6 +48,7 @@ OPTIONS
4848
--prefix=<prefix>/::
4949
Prepend <prefix>/ to each filename in the archive.
5050

51+
-o <file>::
5152
--output=<file>::
5253
Write the archive to <file> instead of stdout.
5354

archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static int parse_archive_args(int argc, const char **argv,
283283
OPT_STRING(0, "format", &format, "fmt", "archive format"),
284284
OPT_STRING(0, "prefix", &base, "prefix",
285285
"prepend prefix to each pathname in the archive"),
286-
OPT_STRING(0, "output", &output, "file",
286+
OPT_STRING('o', "output", &output, "file",
287287
"write the archive to this file"),
288288
OPT_BOOLEAN(0, "worktree-attributes", &worktree_attributes,
289289
"read .gitattributes in working directory"),

builtin-archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
7171
const char *output = NULL;
7272
const char *remote = NULL;
7373
struct option local_opts[] = {
74-
OPT_STRING(0, "output", &output, "file",
74+
OPT_STRING('o', "output", &output, "file",
7575
"write the archive to this file"),
7676
OPT_STRING(0, "remote", &remote, "repo",
7777
"retrieve the archive from remote repository <repo>"),

0 commit comments

Comments
 (0)