Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
show-ref: fix --exclude-existing
author
Junio C Hamano
<junkio@cox.net>
Mon, 18 Dec 2006 21:33:47 +0000
(13:33 -0800)
committer
Junio C Hamano
<junkio@cox.net>
Mon, 18 Dec 2006 21:40:25 +0000
(13:40 -0800)
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>
builtin-show-ref.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
0c7a97f
)
diff --git
a/builtin-show-ref.c
b/builtin-show-ref.c
index 296070628c0d631ea5af1124415ce71e71c11c08..853f13f6ae9df60e340a6988a9d74bb246df4df6 100644
(file)
--- a/
builtin-show-ref.c
+++ b/
builtin-show-ref.c
@@
-4,7
+4,7
@@
#include "tag.h"
#include "path-list.h"
#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;
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)) {
for_each_ref(add_existing, &existing_refs);
while (fgets(buf, sizeof(buf), stdin)) {
- int len = strlen(buf);
char *ref;
char *ref;
+ int len = strlen(buf);
+
if (len > 0 && buf[len - 1] == '\n')
buf[--len] = '\0';
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';
}
len -= 3;
buf[len] = '\0';
}