diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2013-01-12 13:47:56 -0600 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2013-01-12 13:47:56 -0600 |
| commit | 25743bd7c5f14f2287d9c4fdf953c978e3b16916 (patch) | |
| tree | 7390d1d2d5d52f549329853903f381e58c1b1de6 /src/index.c | |
| parent | e2d2c6e57d122f381fb42b7df1c7a12819050490 (diff) | |
| download | libgit2-25743bd7c5f14f2287d9c4fdf953c978e3b16916.tar.gz | |
add an index_remove_bypath that removes conflicts, renamed add_from_workdir to match
Diffstat (limited to 'src/index.c')
| -rw-r--r-- | src/index.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c index 606a431a4..76384288e 100644 --- a/src/index.c +++ b/src/index.c @@ -730,7 +730,7 @@ static int index_conflict_to_reuc(git_index *index, const char *path) return ret; } -int git_index_add_from_workdir(git_index *index, const char *path) +int git_index_add_bypath(git_index *index, const char *path) { git_index_entry *entry = NULL; int ret; @@ -753,6 +753,21 @@ on_error: return ret; } +int git_index_remove_bypath(git_index *index, const char *path) +{ + int ret; + + assert(index && path); + + if (((ret = git_index_remove(index, path, 0)) < 0 && + ret != GIT_ENOTFOUND) || + ((ret = index_conflict_to_reuc(index, path)) < 0 && + ret != GIT_ENOTFOUND)) + return ret; + + return 0; +} + int git_index_add(git_index *index, const git_index_entry *source_entry) { git_index_entry *entry = NULL; |
