Hey Pranit, On 12/07/2016 12:02 AM, Pranit Bauva wrote: >>> +static int bisect_replay(struct bisect_terms *terms, const char *filename) >>> +{ >>> + struct strbuf line = STRBUF_INIT; >>> + struct strbuf word = STRBUF_INIT; >>> + FILE *fp = NULL; >> >> (The initialization is not necessary here.) > > Um. I think it is. Otherwise if it goes to the finish block before you > try to operate on fp, it will cause a seg fault. You are right, thanks! >>> + while (strbuf_getline(&line, fp) != EOF) { >>> + int pos = 0; >>> + while (pos < line.len) { >>> + pos = get_next_word(line.buf, pos, &word); >>> + >>> + if (!strcmp(word.buf, "git")) { >>> + continue; >>> + } else if (!strcmp(word.buf, "git-bisect")) { >>> + continue; >>> + } else if (!strcmp(word.buf, "bisect")) { >>> + continue; >>> + } else if (!strcmp(word.buf, "#")) { >>> + break; >> >> Maybe it is more robust to check whether word.buf begins with # > > Assuming that you meant "# ", yes. No, if I get it right "# " can never occur because the word.buf never contains a space. What I meant was that you are currently ignoring everything after a "# ", so comments like # foo are ignored. However, imagine a user changes the file by hand (he probably should not do it but, hey, it's git: unixy, hacky ... and he thinks he knows what he does) and then we have in the file something like #foo which makes perfectly sense when you are used to programming languages with # as comment-till-eol marker. The problem is that your current code does expect "#" as a single word and would hence not recognize #foo as a comment. I hope I made it clear why I suggested to test if the word *begins* with "#" (not "# "). ~Stephan