Code

Documentation: let asciidoc align related options
[git.git] / builtin-for-each-ref.c
index 4d25ec51d009bf18f95c60ca9ccd641ac5792db6..72c087840c39bc03b142ba620f94800d40264eb9 100644 (file)
@@ -320,9 +320,7 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un
 
 static const char *copy_line(const char *buf)
 {
-       const char *eol = strchr(buf, '\n');
-       if (!eol)
-               return "";
+       const char *eol = strchrnul(buf, '\n');
        return xmemdupz(buf, eol - buf);
 }
 
@@ -652,7 +650,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;