git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] for-each-ref: Allow a trailing slash in the patterns
@ 2008-08-28  2:14 Björn Steinbrink
  0 siblings, 0 replies; only message in thread
From: Björn Steinbrink @ 2008-08-28  2:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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>
---
 builtin-for-each-ref.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 4d25ec5..21e92bb 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;
-- 
1.6.0.1.90.g27a6e.dirty

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-08-28  2:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-28  2:14 [PATCH] for-each-ref: Allow a trailing slash in the patterns Björn Steinbrink

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).