Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apply.c')
-rw-r--r--apply.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/apply.c b/apply.c
index 8bff604dbe..4cba4ce71a 100644
--- a/apply.c
+++ b/apply.c
@@ -3747,10 +3747,13 @@ static int check_to_create(struct apply_state *state,
{
struct stat nst;
- if (state->check_index &&
- index_name_pos(state->repo->index, new_name, strlen(new_name)) >= 0 &&
- !ok_if_exists)
- return EXISTS_IN_INDEX;
+ if (state->check_index && !ok_if_exists) {
+ int pos = index_name_pos(state->repo->index, new_name, strlen(new_name));
+ if (pos >= 0 &&
+ !(state->repo->index->cache[pos]->ce_flags & CE_INTENT_TO_ADD))
+ return EXISTS_IN_INDEX;
+ }
+
if (state->cached)
return 0;