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 | |
| 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')
| -rw-r--r-- | src/index.c | 17 | ||||
| -rw-r--r-- | src/stash.c | 2 | ||||
| -rw-r--r-- | src/submodule.c | 2 |
3 files changed, 18 insertions, 3 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; diff --git a/src/stash.c b/src/stash.c index e63a362f0..d4f81aefe 100644 --- a/src/stash.c +++ b/src/stash.c @@ -208,7 +208,7 @@ static int update_index_cb( } if (add_path != NULL) - data->error = git_index_add_from_workdir(data->index, add_path); + data->error = git_index_add_bypath(data->index, add_path); return data->error; } diff --git a/src/submodule.c b/src/submodule.c index a72326602..a38ece079 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -332,7 +332,7 @@ int git_submodule_add_finalize(git_submodule *sm) assert(sm); if ((error = git_repository_index__weakptr(&index, sm->owner)) < 0 || - (error = git_index_add_from_workdir(index, GIT_MODULES_FILE)) < 0) + (error = git_index_add_bypath(index, GIT_MODULES_FILE)) < 0) return error; return git_submodule_add_to_index(sm, true); |
