builtin/apply: make gitdiff_*() return -1 on error