commit ede9a86acbafeb41c2521bc32df592eb913a3f7e from: Stefan Sperling date: Wed Oct 07 23:28:23 2020 UTC fix edscript diff output for empty files commit - 11d9f2f72df165e4dbfdabac9708d307aa61cab3 commit + ede9a86acbafeb41c2521bc32df592eb913a3f7e blob - 4ee960cab7a4020d7f2a8ed9b40e0a1bc9ae768a blob + 0e674f6fe015a5e0df8b5522d22d0630090a0f70 --- lib/diff_output_edscript.c +++ lib/diff_output_edscript.c @@ -40,6 +40,8 @@ output_edscript_chunk(struct diff_output_info *outinfo left_len = cc->left.end - cc->left.start; if (left_len < 0) return EINVAL; + else if (result->left.atoms.len == 0) + left_start = 0; else if (left_len == 0 && cc->left.start > 0) left_start = cc->left.start; else @@ -48,6 +50,8 @@ output_edscript_chunk(struct diff_output_info *outinfo right_len = cc->right.end - cc->right.start; if (right_len < 0) return EINVAL; + else if (result->right.atoms.len == 0) + right_start = 0; else if (right_len == 0 && cc->right.start > 0) right_start = cc->right.start; else