Skip to content

Commit

Permalink
Merge branch 'jc/apply'
Browse files Browse the repository at this point in the history
* jc/apply:
  apply --cached: do not check newly added file in the working tree
  • Loading branch information
Junio C Hamano committed May 19, 2006
2 parents 667661d + d91d4c2 commit edd5cc2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit edd5cc2

Please sign in to comment.