MCPcopy Create free account
hub / github.com/git/git / read_bisect_terms

Function read_bisect_terms

bisect.c:1005–1031  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

1003 * Default is bad/good.
1004 */
1005void 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

Callers 3

bisect_next_allFunction · 0.85
cmd_rev_parseFunction · 0.85

Calls 5

xstrdupFunction · 0.85
die_errnoFunction · 0.85
strbuf_getline_lfFunction · 0.85
strbuf_detachFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected