X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-for-each-ref.c;h=21e92bbcb577c0361df51bd81e6fb5ab546619ea;hb=53b543ab8218cede7fb9383298c00dcef663692c;hp=445039e19c75e4c9321f7ee64289ef8201a25c14;hpb=f44bc33c7283c19a86797ffdaafd22a19bbdfbd6;p=git.git diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index 445039e19..21e92bbcb 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -459,8 +459,10 @@ static void find_subpos(const char *buf, unsigned long sz, const char **sub, con return; *sub = buf; /* first non-empty line */ buf = strchr(buf, '\n'); - if (!buf) + if (!buf) { + *body = ""; return; /* no body */ + } while (*buf == '\n') buf++; /* skip blank between subject and body */ *body = buf; @@ -650,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;