Merge branch 'jc/apply' into next
* jc/apply: apply --cached: do not check newly added file in the working tree
This commit is contained in:
commit
b312cc82b4
4
apply.c
4
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 (new_name && (patch->is_new | patch->is_rename | patch->is_copy)) {
|
||||||
if (check_index && cache_name_pos(new_name, strlen(new_name)) >= 0)
|
if (check_index && cache_name_pos(new_name, strlen(new_name)) >= 0)
|
||||||
return error("%s: already exists in index", new_name);
|
return error("%s: already exists in index", new_name);
|
||||||
if (!cached && !lstat(new_name, &st))
|
if (!cached) {
|
||||||
|
if (!lstat(new_name, &st))
|
||||||
return error("%s: already exists in working directory", new_name);
|
return error("%s: already exists in working directory", new_name);
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
return error("%s: %s", new_name, strerror(errno));
|
return error("%s: %s", new_name, strerror(errno));
|
||||||
|
}
|
||||||
if (!patch->new_mode) {
|
if (!patch->new_mode) {
|
||||||
if (patch->is_new)
|
if (patch->is_new)
|
||||||
patch->new_mode = S_IFREG | 0644;
|
patch->new_mode = S_IFREG | 0644;
|
||||||
|
Loading…
Reference in New Issue
Block a user