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

Function write_commit_patch

builtin/am.c:1398–1420  ·  view source on GitHub ↗

* Writes `commit` as a patch to the state directory's "patch" file. */

Source from the content-addressed store, hash-verified

1396 * Writes `commit` as a patch to the state directory's "patch" file.
1397 */
1398static void write_commit_patch(const struct am_state *state, struct commit *commit)
1399{
1400 struct rev_info rev_info;
1401 FILE *fp;
1402
1403 fp = xfopen(am_path(state, "patch"), "w");
1404 repo_init_revisions(the_repository, &rev_info, NULL);
1405 rev_info.diff = 1;
1406 rev_info.abbrev = 0;
1407 rev_info.disable_stdin = 1;
1408 rev_info.show_root_diff = 1;
1409 rev_info.diffopt.output_format = DIFF_FORMAT_PATCH;
1410 rev_info.no_commit_id = 1;
1411 rev_info.diffopt.flags.binary = 1;
1412 rev_info.diffopt.flags.full_index = 1;
1413 rev_info.diffopt.use_color = GIT_COLOR_NEVER;
1414 rev_info.diffopt.file = fp;
1415 rev_info.diffopt.close_file = 1;
1416 add_pending_object(&rev_info, &commit->object, "");
1417 diff_setup_done(&rev_info.diffopt);
1418 log_tree_commit(&rev_info, commit);
1419 release_revisions(&rev_info);
1420}
1421
1422/**
1423 * Writes the diff of the index against HEAD as a patch to the state

Callers 1

parse_mail_rebaseFunction · 0.85

Calls 7

xfopenFunction · 0.85
am_pathFunction · 0.85
repo_init_revisionsFunction · 0.85
add_pending_objectFunction · 0.85
diff_setup_doneFunction · 0.85
log_tree_commitFunction · 0.85
release_revisionsFunction · 0.85

Tested by

no test coverage detected