Skip to content

Commit e7e5548

Browse files
committed
Merge branch 'maint'
* maint: clone: detect extra arguments clone: fix help on options push: fix typo in usage More precise description of 'git describe --abbrev'
2 parents 15c6bf0 + d52dc4b commit e7e5548

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

Documentation/git-describe.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ OPTIONS
4444

4545
--abbrev=<n>::
4646
Instead of using the default 7 hexadecimal digits as the
47-
abbreviated object name, use <n> digits.
47+
abbreviated object name, use <n> digits, or as many digits
48+
as needed to form a unique object name. An <n> of 0
49+
will suppress long format, only showing the closest tag.
4850

4951
--candidates=<n>::
5052
Instead of considering only the 10 most recent tags as
@@ -68,8 +70,8 @@ OPTIONS
6870
This is useful when you want to see parts of the commit object name
6971
in "describe" output, even when the commit in question happens to be
7072
a tagged version. Instead of just emitting the tag name, it will
71-
describe such a commit as v1.2-0-deadbeef (0th commit since tag v1.2
72-
that points at object deadbeef....).
73+
describe such a commit as v1.2-0-gdeadbee (0th commit since tag v1.2
74+
that points at object deadbee....).
7375

7476
--match <pattern>::
7577
Only consider tags matching the given pattern (can be used to avoid
@@ -108,7 +110,7 @@ the output shows the reference path as well:
108110
[torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2
109111
tags/v1.0.0-21-g975b
110112

111-
[torvalds@g5 git]$ git describe --all HEAD^
113+
[torvalds@g5 git]$ git describe --all --abbrev=4 HEAD^
112114
heads/lt/describe-7-g975b
113115

114116
With --abbrev set to 0, the command can be used to find the
@@ -117,6 +119,13 @@ closest tagname without any suffix:
117119
[torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2
118120
tags/v1.0.0
119121

122+
Note that the suffix you get if you type these commands today may be
123+
longer than what Linus saw above when he ran this command, as your
124+
git repository may have new commits whose object names begin with
125+
975b that did not exist back then, and "-g975b" suffix alone may not
126+
be sufficient to disambiguate these commits.
127+
128+
120129
SEARCH STRATEGY
121130
---------------
122131

builtin-clone.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ static struct option builtin_clone_options[] = {
5151
OPT_BOOLEAN('n', "no-checkout", &option_no_checkout,
5252
"don't create a checkout"),
5353
OPT_BOOLEAN(0, "bare", &option_bare, "create a bare repository"),
54-
OPT_BOOLEAN(0, "naked", &option_bare, "create a bare repository"),
54+
{ OPTION_BOOLEAN, 0, "naked", &option_bare, NULL,
55+
"create a bare repository",
56+
PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
5557
OPT_BOOLEAN(0, "mirror", &option_mirror,
5658
"create a mirror repository (implies bare)"),
5759
OPT_BOOLEAN('l', "local", &option_local,
@@ -61,7 +63,7 @@ static struct option builtin_clone_options[] = {
6163
OPT_BOOLEAN('s', "shared", &option_shared,
6264
"setup as shared repository"),
6365
OPT_BOOLEAN(0, "recursive", &option_recursive,
64-
"setup as shared repository"),
66+
"initialize submodules in the clone"),
6567
OPT_STRING(0, "template", &option_template, "path",
6668
"path the template repository"),
6769
OPT_STRING(0, "reference", &option_reference, "repo",
@@ -377,8 +379,13 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
377379
argc = parse_options(argc, argv, prefix, builtin_clone_options,
378380
builtin_clone_usage, 0);
379381

382+
if (argc > 2)
383+
usage_msg_opt("Too many arguments.",
384+
builtin_clone_usage, builtin_clone_options);
385+
380386
if (argc == 0)
381-
die("You must specify a repository to clone.");
387+
usage_msg_opt("You must specify a repository to clone.",
388+
builtin_clone_usage, builtin_clone_options);
382389

383390
if (option_mirror)
384391
option_bare = 1;

builtin-push.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
181181
OPT_BIT( 0 , "all", &flags, "push all refs", TRANSPORT_PUSH_ALL),
182182
OPT_BIT( 0 , "mirror", &flags, "mirror all refs",
183183
(TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
184-
OPT_BOOLEAN( 0 , "tags", &tags, "push tags (can't be used with --all or --mirror"),
184+
OPT_BOOLEAN( 0 , "tags", &tags, "push tags (can't be used with --all or --mirror)"),
185185
OPT_BIT('n' , "dry-run", &flags, "dry run", TRANSPORT_PUSH_DRY_RUN),
186186
OPT_BIT( 0, "porcelain", &flags, "machine-readable output", TRANSPORT_PUSH_PORCELAIN),
187187
OPT_BIT('f', "force", &flags, "force updates", TRANSPORT_PUSH_FORCE),

0 commit comments

Comments
 (0)