commit - 827bcd6cc3f70dfd7830fe13e687ce1885d5d670
commit + 05737d499ba523bccc36cbb584307259af88da88
blob - cb80bed14230259d21207905afb95b11f1e4063c
blob + 0a98afc1b334061cef12aac2a80ebe56c7b4a167
--- lib/patch.c
+++ lib/patch.c
}
static const struct got_error *
-patch_file(struct got_patch *p, FILE *orig, FILE *tmp, int nop, mode_t *mode)
+patch_file(struct got_patch *p, FILE *orig, FILE *tmp, mode_t *mode)
{
const struct got_error *err = NULL;
struct got_patch_hunk *h;
h = STAILQ_FIRST(&p->head);
if (h == NULL || STAILQ_NEXT(h, entries) != NULL)
return got_error(GOT_ERR_PATCH_MALFORMED);
- if (nop)
- return NULL;
return apply_hunk(tmp, h, &lineno);
}
h->err = err;
if (err != NULL)
return err;
- if (!nop)
- err = copy(tmp, orig, copypos, pos);
+ err = copy(tmp, orig, copypos, pos);
if (err != NULL)
return err;
copypos = pos;
if (lineno + 1 != h->old_from)
h->offset = lineno + 1 - h->old_from;
- if (!nop)
- err = apply_hunk(tmp, h, &lineno);
+ err = apply_hunk(tmp, h, &lineno);
if (err != NULL)
return err;
h = STAILQ_FIRST(&p->head);
h->err = got_error(GOT_ERR_HUNK_FAILED);
err = h->err;
- } else if (!nop && !feof(orig))
+ } else if (!feof(orig))
err = copy(tmp, orig, copypos, -1);
return err;
goto done;
}
- if (!nop)
- err = got_opentemp_named(&tmppath, &tmp, template);
+ err = got_opentemp_named(&tmppath, &tmp, template);
if (err)
goto done;
- err = patch_file(p, oldfile, tmp, nop, &mode);
+ err = patch_file(p, oldfile, tmp, &mode);
if (err)
goto done;