X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=apply.c;h=5341e309224b227f2fb430c448192cd7642348cf;hb=9c0f4823614cf80b0d110a648d95de84be5b7bd3;hp=5bd50733656eee24f59486553f5afaaac9a784bc;hpb=aedb8995f841949ce29e05ea7e5c03c2d5466089;p=git.git diff --git a/apply.c b/apply.c index 5bd507336..5341e3092 100644 --- a/apply.c +++ b/apply.c @@ -1712,10 +1712,12 @@ static int check_patch(struct patch *patch) if (new_name && (patch->is_new | patch->is_rename | patch->is_copy)) { if (check_index && cache_name_pos(new_name, strlen(new_name)) >= 0) return error("%s: already exists in index", new_name); - if (!cached && !lstat(new_name, &st)) - return error("%s: already exists in working directory", new_name); - if (errno != ENOENT) - return error("%s: %s", new_name, strerror(errno)); + if (!cached) { + if (!lstat(new_name, &st)) + return error("%s: already exists in working directory", new_name); + if (errno != ENOENT) + return error("%s: %s", new_name, strerror(errno)); + } if (!patch->new_mode) { if (patch->is_new) patch->new_mode = S_IFREG | 0644;