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:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2008-08-28 06:14:02 +0400
committerJunio C Hamano <gitster@pobox.com>2008-08-29 11:14:06 +0400
commit114ef90854c395145594974c222a004060b2acd1 (patch)
tree7e81f878397b29a9d1f5e9d44b26a6766766e0f8 /builtin-for-each-ref.c
parentc67b1fa349cc7b4341b32b9ef1c58a3821ce0830 (diff)
for-each-ref: Allow a trailing slash in the patterns
More often than not, I end up using something like refs/remotes/ as the pattern for for-each-ref, but that doesn't work, because it expects to see the slash in the ref name right after the matched pattern. So teach it to accept the slash as the final character in the pattern as well. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-for-each-ref.c')
-rw-r--r--builtin-for-each-ref.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 4d25ec51d0..21e92bbcb5 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -652,7 +652,8 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int f
if ((plen <= namelen) &&
!strncmp(refname, p, plen) &&
(refname[plen] == '\0' ||
- refname[plen] == '/'))
+ refname[plen] == '/' ||
+ p[plen-1] == '/'))
break;
if (!fnmatch(p, refname, FNM_PATHNAME))
break;