commit - 311b7e33449ba2b480b546b8e5b79221b1539b70
commit + 445d38d7eafbd42b45d230374395225256a9994e
blob - b662fd9440dd44cb727518f3d66665658c6eea34
blob + e1e9258d4e6f76c6226e2040023e078361240dd1
--- lib/patch.c
+++ lib/patch.c
}
return NULL;
}
+
+static int linecmp(const char *, const char *, int *);
static const struct got_error *
locate_hunk(FILE *orig, struct got_patch_hunk *h, off_t *pos, int *lineno)
size_t linesize = 0;
ssize_t linelen;
off_t match = -1;
- int match_lineno = -1;
+ int mangled = 0, match_lineno = -1;
for (;;) {
linelen = getline(&line, &linesize, orig);
line[linelen - 1] = '\0';
(*lineno)++;
- if ((mode == ' ' && !strcmp(h->lines[0] + 1, line)) ||
- (mode == '-' && !strcmp(h->lines[0] + 1, line)) ||
+ if ((mode == ' ' && !linecmp(h->lines[0] + 1, line, &mangled)) ||
+ (mode == '-' && !linecmp(h->lines[0] + 1, line, &mangled)) ||
(mode == '+' && *lineno == h->old_from)) {
match = ftello(orig);
if (match == -1) {
break;
}
+ if (mangled)
+ h->ws_mangled = 1;
+
if (err == NULL) {
*pos = match;
*lineno = match_lineno;