Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-12-19 00:33:47 +0300
committerJunio C Hamano <junkio@cox.net>2006-12-19 00:40:25 +0300
commitd8285af4810f655e28a0ae0e71a28a920bb6871f (patch)
tree26e08675586644983dbf9891c0ded2b413bf6f60 /builtin-show-ref.c
parent0c7a97fafdaf7911183807019dbbb4d8c5079c4e (diff)
show-ref: fix --exclude-existing
Do not falsely document --filter-invalid which does not even exist. Also make sure the line is long enough to have ^{} suffix before checking for it. Pointed out by Dscho. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-show-ref.c')
-rw-r--r--builtin-show-ref.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin-show-ref.c b/builtin-show-ref.c
index 296070628c..853f13f6ae 100644
--- a/builtin-show-ref.c
+++ b/builtin-show-ref.c
@@ -4,7 +4,7 @@
#include "tag.h"
#include "path-list.h"
-static const char show_ref_usage[] = "git show-ref [-q|--quiet] [--verify] [-h|--head] [-d|--dereference] [-s|--hash[=<length>]] [--abbrev[=<length>]] [--tags] [--heads] [--] [pattern*] | --filter-invalid < ref-list";
+static const char show_ref_usage[] = "git show-ref [-q|--quiet] [--verify] [-h|--head] [-d|--dereference] [-s|--hash[=<length>]] [--abbrev[=<length>]] [--tags] [--heads] [--] [pattern*] < ref-list";
static int deref_tags = 0, show_head = 0, tags_only = 0, heads_only = 0,
found_match = 0, verify = 0, quiet = 0, hash_only = 0, abbrev = 0;
@@ -116,11 +116,12 @@ static int exclude_existing(const char *match)
for_each_ref(add_existing, &existing_refs);
while (fgets(buf, sizeof(buf), stdin)) {
- int len = strlen(buf);
char *ref;
+ int len = strlen(buf);
+
if (len > 0 && buf[len - 1] == '\n')
buf[--len] = '\0';
- if (!strcmp(buf + len - 3, "^{}")) {
+ if (3 <= len && !strcmp(buf + len - 3, "^{}")) {
len -= 3;
buf[len] = '\0';
}