* The terms used for this bisect session are stored in BISECT_TERMS. * We read them and store them to adapt the messages accordingly. * Default is bad/good. */
| 1003 | * Default is bad/good. |
| 1004 | */ |
| 1005 | void read_bisect_terms(char **read_bad, char **read_good) |
| 1006 | { |
| 1007 | struct strbuf str = STRBUF_INIT; |
| 1008 | const char *filename = git_path_bisect_terms(); |
| 1009 | FILE *fp = fopen(filename, "r"); |
| 1010 | |
| 1011 | if (!fp) { |
| 1012 | if (errno == ENOENT) { |
| 1013 | free(*read_bad); |
| 1014 | *read_bad = xstrdup("bad"); |
| 1015 | free(*read_good); |
| 1016 | *read_good = xstrdup("good"); |
| 1017 | return; |
| 1018 | } else { |
| 1019 | die_errno(_("could not read file '%s'"), filename); |
| 1020 | } |
| 1021 | } else { |
| 1022 | strbuf_getline_lf(&str, fp); |
| 1023 | free(*read_bad); |
| 1024 | *read_bad = strbuf_detach(&str, NULL); |
| 1025 | strbuf_getline_lf(&str, fp); |
| 1026 | free(*read_good); |
| 1027 | *read_good = strbuf_detach(&str, NULL); |
| 1028 | } |
| 1029 | strbuf_release(&str); |
| 1030 | fclose(fp); |
| 1031 | } |
| 1032 | |
| 1033 | /* |
| 1034 | * We use the convention that return BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND (-10) means |
no test coverage detected