diff options
author | Russell Belfer <rb@github.com> | 2014-04-21 11:54:54 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-21 11:54:54 -0700 |
commit | bd101a7eca6907ab1dd57ae693059466df0da124 (patch) | |
tree | 24e8c53f3ea6ec7759162f427089f745237f9e91 /src/reset.c | |
parent | 28750a7d98ce5e23bac5c1d119109ded8e8aab73 (diff) | |
download | libgit2-bd101a7eca6907ab1dd57ae693059466df0da124.tar.gz |
Fix reset for staged deletes
Diffstat (limited to 'src/reset.c')
-rw-r--r-- | src/reset.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/reset.c b/src/reset.c index e403e2a9a..248c91d3a 100644 --- a/src/reset.c +++ b/src/reset.c @@ -60,13 +60,18 @@ int git_reset_default( for (i = 0, max_i = git_diff_num_deltas(diff); i < max_i; ++i) { const git_diff_delta *delta = git_diff_get_delta(diff, i); - if ((error = git_index_conflict_remove(index, delta->old_file.path)) < 0) - goto cleanup; - assert(delta->status == GIT_DELTA_ADDED || delta->status == GIT_DELTA_MODIFIED || delta->status == GIT_DELTA_DELETED); + error = git_index_conflict_remove(index, delta->old_file.path); + if (error < 0) { + if (delta->status == GIT_DELTA_ADDED && error == GIT_ENOTFOUND) + giterr_clear(); + else + goto cleanup; + } + if (delta->status == GIT_DELTA_DELETED) { if ((error = git_index_remove(index, delta->old_file.path, 0)) < 0) goto cleanup; |