commit a42e5f4ff97c315089711cf82a4ac526215f7af1 from: Tom Jones via: Thomas Adam date: Fri Sep 02 15:54:01 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 - 4b083231d119f9618f30740eb6cb240f10fee770 commit + a42e5f4ff97c315089711cf82a4ac526215f7af1 blob - ec70e57bff6e373352417678b49cb40fc0431e6c blob + aa587f957a502cfe88805538dd3b94c05b174498 --- lib/diff3.c +++ lib/diff3.c @@ -240,7 +240,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 - ec7805123586f40fc51bef645d1f9db8e381f579 blob + e1de427d6a2c4fff83c03ea5747e10bd7c4c7a07 --- lib/diffreg.c +++ lib/diffreg.c @@ -278,8 +278,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 {