diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-05-19 18:29:15 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-05-28 09:47:51 -0400 |
commit | 9b3e41f72bd9ab62e8d129713755c3a3a71359bc (patch) | |
tree | bcd61051d920bf2568d5f45ab53a0dd31d662679 | |
parent | 10549a2df166cd3b951c65ab89c33f7ef21c6b7a (diff) | |
download | libgit2-9b3e41f72bd9ab62e8d129713755c3a3a71359bc.tar.gz |
index_add_all: remove conflicts when no wd file
If there exists a conflict in the index, but no file in the working
directory, this implies that the user wants to accept the resolution
by removing the file. Thus, remove the conflict entry from the
index, instead of trying to add a (nonexistent) file.
-rw-r--r-- | src/index.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c index bd65d924b..0422ff1d4 100644 --- a/src/index.c +++ b/src/index.c @@ -2670,7 +2670,8 @@ static int apply_each_file(const git_diff_delta *delta, float progress, void *pa if (error < 0) /* actual error */ return error; - if (delta->status == GIT_DELTA_DELETED) + /* If the workdir item does not exist, remove it from the index. */ + if ((delta->new_file.flags & GIT_DIFF_FLAG_EXISTS) == 0) error = git_index_remove_bypath(data->index, path); else error = git_index_add_bypath(data->index, delta->new_file.path); |