[PATCH 0/1] describe a blob: with better docs
- From
Stefan Beller <sbeller@google.com>
- Date
- Nov 10, 2017, 22:44 UTC
- Message-ID
- <20171110224425.15299-1-sbeller@google.com>
- In-Reply-To
- <xmqqo9obhqo0.fsf@gitster.mtv.corp.google.com>
This replaces the last patch of origin/sb/describe-blob. Interdiff is below.
I chose to not mention options at all, as currently none are applicable; Check for options and tell the user by die()ing that we don't know about the options for blobs.
Thanks, Stefan
builtin/describe.c: describe a blob
Documentation/git-describe.txt | 13 +++++++- builtin/describe.c | 71 ++++++++++++++++++++++++++++++++++++++---- t/t6120-describe.sh | 15 +++++++++ 3 files changed, 92 insertions(+), 7 deletions(-)
--
2.15.0.128.gcadd42da22
diff --git c/Documentation/git-describe.txt w/Documentation/git-describe.txt
index 79ec0be62a..a25443ca91 100644
--- c/Documentation/git-describe.txt
+++ w/Documentation/git-describe.txt
@@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git describe' [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]
'git describe' [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]
-'git describe' [<options>] <blob>
+'git describe' <blob>
DESCRIPTION
-----------
diff --git c/builtin/describe.c w/builtin/describe.c
index cf08bef344..acfd853a30 100644
--- c/builtin/describe.c
+++ w/builtin/describe.c
@@ -501,9 +501,13 @@ static void describe(const char *arg, int last_one)
if (cmit)
describe_commit(&oid, &sb);
- else if (lookup_blob(&oid))
+ else if (lookup_blob(&oid)) {
+ if (all || tags || longformat || first_parent ||
+ patterns.nr || exclude_patterns.nr ||
+ always || dirty || broken)
+ die(_("options not available for describing blobs"));
describe_blob(oid, &sb);
- else
+ } else
die(_("%s is neither a commit nor blob"), arg);
puts(sb.buf);