Download raw body.
fix diff3 for files lacking trailing \n
Josh Rickmar reported a bug on #gameoftrees IRC that ended up being
shared with diff3 code inherited from OpenBSD. See here for details
and patches for the OpenBSD base tools:
https://marc.info/?l=openbsd-tech&m=161825519000776&w=2
This is the corresponding fix for the diff3 code in Got.
It makes the problematic cherrypick which Josh identified succeed.
ok?
diff 6c19a3dcfa5f03ec889d629dded9ff4dfa9f6237 /home/stsp/src/got
blob - 6343f4f287533c9a4793e0e93a169a6bc59a5d23
file + lib/diff3.c
--- lib/diff3.c
+++ lib/diff3.c
@@ -885,10 +885,12 @@ duplicate(int *dpl, int j, struct line_range *r1, stru
for (nline = 0; nline < r1->to - r1->from; nline++) {
do {
c = getc(d3s->fp[0]);
- if (c == EOF)
- return got_ferror(d3s->fp[0], GOT_ERR_EOF);
d = getc(d3s->fp[1]);
- if (d == EOF)
+ if (c == EOF && d == EOF)
+ break;
+ else if (c == EOF)
+ return got_ferror(d3s->fp[0], GOT_ERR_EOF);
+ else if (d == EOF)
return got_ferror(d3s->fp[1], GOT_ERR_EOF);
nchar++;
if (c != d) {
fix diff3 for files lacking trailing \n