From: Christian Couder Date: Wed, 13 Jun 2012 10:05:11 GMT Subject: Re: [PATCHv2] git bisect old/new Message-ID: In-Reply-To: <1339541765-2078-1-git-send-email-Valentin.Duperray@ensimag.imag.fr> On Wed, Jun 13, 2012 at 12:56 AM, Valentin Duperray wrote: > > Related discussions: > >        - http://thread.gmane.org/gmane.comp.version-control.git/86063 >                introduced bisect fix unfixed to find fix. >        - http://thread.gmane.org/gmane.comp.version-control.git/182398 >                discussion around bisect yes/no or old/new. Thanks! >  /* > + * The terms used for this bisect session are stocked in > + * BISECT_TERMS: it can be bad/good or new/old. > + * We read them and stock them to adapt the messages > + * accordingly. Default is bad/good. > + */ > +void read_bisect_terms(void) > +{ > +       struct strbuf str = STRBUF_INIT; > +       const char *filename = git_path("BISECT_TERMS"); > +       FILE *fp = fopen(filename, "r"); > + > +       if (!fp) { > +               bisect_bad = "bad"; > +               bisect_good = "good"; Ok, but... > +       } else { > +       strbuf_getline(&str, fp, '\n'); > +       bisect_bad = strbuf_detach(&str, NULL); > +       strbuf_getline(&str, fp, '\n'); > +       bisect_good = strbuf_detach(&str, NULL); > +       } > +       strbuf_release(&str); > +       fclose(fp); > +} > @@ -953,6 +991,8 @@ int bisect_next_all(const char *prefix, int no_checkout) >               "(roughly %d step%s)\n", nr, (nr == 1 ? "" : "s"), >               steps, (steps == 1 ? "" : "s")); > > +       free((char*)bisect_bad); > +       free((char*)bisect_good); ...it is not a good thing to free these variables if they were not allocated. > + >        return bisect_checkout(bisect_rev_hex, no_checkout); >  } >        case "$missing_good,$missing_bad,$1" in >        ,,*) > -               : have both good and bad - ok > +               : have both good and bad or old and new - ok Maybe ": have both $BISECT_GOOD and $BISECT_BAD - ok". Thanks, Christian.