Fix git_apply_patch function: delete patch file even if applying the patch failed.