diff options
author | Jakob Pfender <jpfender@elegosoft.com> | 2011-04-21 10:40:54 +0200 |
---|---|---|
committer | Jakob Pfender <jpfender@elegosoft.com> | 2011-04-21 10:40:54 +0200 |
commit | 729b6f490068642f35ca933ef44830fda11b6aef (patch) | |
tree | f050691216f21fd21d802d529743ca171b599b07 /include/git2/index.h | |
parent | fee4c4255004c1f142e39d6884a4804eb38e3183 (diff) | |
download | libgit2-729b6f490068642f35ca933ef44830fda11b6aef.tar.gz |
index: Allow user to toggle whether to replace an index entry
When in the middle of a merge, the index needs to contain several files
with the same name. git_index_insert() used to prevent this by not adding a new entry if an entry with the same name already existed.
Diffstat (limited to 'include/git2/index.h')
-rw-r--r-- | include/git2/index.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/git2/index.h b/include/git2/index.h index 8a84f507..adc4cb43 100644 --- a/include/git2/index.h +++ b/include/git2/index.h @@ -203,15 +203,16 @@ GIT_EXTERN(int) git_index_remove(git_index *index, int position); /** * Insert an entry into the index. * A full copy (including the 'path' string) of the given - * 'source_entry' will be inserted on the index; if the index - * already contains an entry for the same path, the entry - * will be updated. + * 'source_entry' will be inserted on the index; if the + * replace flag is not set and the index already contains + * an entry for the same path, the entry will be updated. * * @param index an existing index object * @param source_entry new entry object + * @param replace if set, existing entries will be replaced * @return 0 on success, otherwise an error code */ -GIT_EXTERN(int) git_index_insert(git_index *index, const git_index_entry *source_entry); +GIT_EXTERN(int) git_index_insert(git_index *index, const git_index_entry *source_entry, int replace); /** * Get a pointer to one of the entries in the index |