summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 32574b6)
raw | patch | inline | side by side (parent: 32574b6)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Wed, 15 Dec 2010 09:02:54 +0000 (16:02 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 16 Dec 2010 21:11:42 +0000 (13:11 -0800) |
Empty regex pattern should always match. But the exact behavior of
regexec() may vary. Because it always matches anyway, we can just
return 'matched' without calling regex machinery.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
regexec() may vary. Because it always matches anyway, we can just
return 'matched' without calling regex machinery.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c | patch | blob | history |
diff --git a/sha1_name.c b/sha1_name.c
index 1ba4bc3b686f30d77ab0aad881681b4d6b53531f..c5c59ced7f0cbd9ced026d44df6439da65082fb8 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
int ret;
struct commit_list *list = NULL;
+ /*
+ * $commit^{/}. Some regex implementation may reject.
+ * We don't need regex anyway. '' pattern always matches.
+ */
+ if (sp[1] == '}')
+ return 0;
+
prefix = xstrndup(sp + 1, name + len - 1 - (sp + 1));
commit_list_insert((struct commit *)o, &list);
ret = get_sha1_oneline(prefix, sha1, list);