MCPcopy Index your code
hub / github.com/git/git / read_graft_file

Function read_graft_file

commit.c:287–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287static int read_graft_file(struct repository *r, const char *graft_file)
288{
289 FILE *fp = fopen_or_warn(graft_file, "r");
290 struct strbuf buf = STRBUF_INIT;
291 if (!fp)
292 return -1;
293 if (!no_graft_file_deprecated_advice &&
294 advice_enabled(ADVICE_GRAFT_FILE_DEPRECATED))
295 advise(_("Support for <GIT_DIR>/info/grafts is deprecated\n"
296 "and will be removed in a future Git version.\n"
297 "\n"
298 "Please use \"git replace --convert-graft-file\"\n"
299 "to convert the grafts into replace refs.\n"
300 "\n"
301 "Turn this message off by running\n"
302 "\"git config set advice.graftFileDeprecated false\""));
303 while (!strbuf_getwholeline(&buf, fp, '\n')) {
304 /* The format is just "Commit Parent1 Parent2 ...\n" */
305 struct commit_graft *graft = read_graft_line(&buf);
306 if (!graft)
307 continue;
308 if (register_commit_graft(r, graft, 1))
309 error("duplicate graft data: %s", buf.buf);
310 }
311 fclose(fp);
312 strbuf_release(&buf);
313 return 0;
314}
315
316void prepare_commit_graft(struct repository *r)
317{

Callers 1

prepare_commit_graftFunction · 0.85

Calls 8

fopen_or_warnFunction · 0.85
advice_enabledFunction · 0.85
adviseFunction · 0.85
strbuf_getwholelineFunction · 0.85
read_graft_lineFunction · 0.85
register_commit_graftFunction · 0.85
errorFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected