@matheusbsbs / matheus-bagliano / commits / 05d3951ec9
Fork 0

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 <dpotapov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dmitry Potapov committed Sep 13, 2009 at 16:05 UTC 05d3951ec9c531d348fe0dbb9ae058d38728a550
3 files changed +4 -3
Documentation/git-archive.txt
+2 -1
@@ -10,7 +10,7 @@ SYNOPSIS
10 --------
11 [verse]
12 'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
13 - [--output=<file>] [--worktree-attributes]
13 + [-o | --output=<file>] [--worktree-attributes]
14 [--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
15 [path...]
16
@@ -48,6 +48,7 @@ OPTIONS
48 --prefix=<prefix>/::
49 Prepend <prefix>/ to each filename in the archive.
50
51 +-o <file>::
52 --output=<file>::
53 Write the archive to <file> instead of stdout.
54
archive.c
+1 -1
@@ -283,7 +283,7 @@ static int parse_archive_args(int argc, const char **argv,
283 OPT_STRING(0, "format", &format, "fmt", "archive format"),
284 OPT_STRING(0, "prefix", &base, "prefix",
285 "prepend prefix to each pathname in the archive"),
286 - OPT_STRING(0, "output", &output, "file",
286 + OPT_STRING('o', "output", &output, "file",
287 "write the archive to this file"),
288 OPT_BOOLEAN(0, "worktree-attributes", &worktree_attributes,
289 "read .gitattributes in working directory"),
builtin-archive.c
+1 -1
@@ -71,7 +71,7 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
71 const char *output = NULL;
72 const char *remote = NULL;
73 struct option local_opts[] = {
74 - OPT_STRING(0, "output", &output, "file",
74 + OPT_STRING('o', "output", &output, "file",
75 "write the archive to this file"),
76 OPT_STRING(0, "remote", &remote, "repo",
77 "retrieve the archive from remote repository <repo>"),