commit d671c3138b0a55e515557fd21584dd92c4b42a14 from: Tom Jones via: Stefan Sperling date: Fri Sep 02 08:40:03 2022 UTC switch diff output mode from "edscript" to "plain" for diff3 getchange() in diff3.c takes any line that starts with an integer and treats it as a hunk header. It doesn't actually require ed script instructions, and traditional ed script diff output would break it. Thus, changing Got's diff3 to rely on plain diff output mode paves the way for implementing traditional ed-script style output in diff.git. Patch by Tom Jones commit - f068d119e029fc8d71da9ccc8e84f86c271b2d77 commit + d671c3138b0a55e515557fd21584dd92c4b42a14 blob - 3acd317409597e7f1fcd02cd18e0db989737c6f4 blob + ca41b5e1c959efef486c9c9c470cd918d4390b7f --- lib/diff3.c +++ lib/diff3.c @@ -241,7 +241,7 @@ diffreg(BUF **d, const char *path1, const char *path2, } err = got_diffreg_output(NULL, NULL, diffreg_result, 1, 1, "", "", - GOT_DIFF_OUTPUT_EDSCRIPT, 0, outfile); + GOT_DIFF_OUTPUT_PLAIN, 0, outfile); if (err) goto done; blob - 6bd8285d6e72edbef809c8c07aa4f74a7e1e0b0d blob + 077eb7fcb67ce1962a147e0f065b0755ec7ac98a --- lib/diffreg.c +++ lib/diffreg.c @@ -277,8 +277,8 @@ got_diffreg_output(struct got_diff_line **lines, size_ if (rc != DIFF_RC_OK) return got_error_set_errno(rc, "diff_output_unidiff"); break; - case GOT_DIFF_OUTPUT_EDSCRIPT: - rc = diff_output_edscript(lines ? &output_info : NULL, + case GOT_DIFF_OUTPUT_PLAIN: + rc = diff_output_plain(lines ? &output_info : NULL, outfile, &info, diff_result->result); if (rc != DIFF_RC_OK) return got_error_set_errno(rc, "diff_output_edscript"); blob - 740595aedb09404e54af0b7760c3df40c71930c1 blob + 8aae9cbb204baa3c88860e324853c5f81cc36b56 --- lib/got_lib_diff.h +++ lib/got_lib_diff.h @@ -20,7 +20,7 @@ enum got_diff_output_format { GOT_DIFF_OUTPUT_UNIDIFF, - GOT_DIFF_OUTPUT_EDSCRIPT, + GOT_DIFF_OUTPUT_PLAIN, }; struct got_diffreg_result {