X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=apply.c;h=0ed9d132e88f52c678a4a64caf3b49d5bc04ee2e;hb=288c0384505e6c25cc1a162242919a0485d50a74;hp=b3b9b40596ef4af5c2187b0d1227e17cadecd342;hpb=9463ed0d737d498be5cbb6672428a8a1fbaf9120;p=git.git diff --git a/apply.c b/apply.c index b3b9b405..0ed9d132 100644 --- a/apply.c +++ b/apply.c @@ -1711,10 +1711,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;