| 285 | } |
| 286 | |
| 287 | static 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 | |
| 316 | void prepare_commit_graft(struct repository *r) |
| 317 | { |
no test coverage detected