diff options
| author | Nikolai Vladimirov <nikolay@vladimiroff.com> | 2013-01-03 16:31:36 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2013-01-04 17:47:51 +0100 |
| commit | b60b4562feac6c17dde9159c437e6e5a908d628e (patch) | |
| tree | a2456424e9f0b1c888ca8c22b11475a42a2e200e /src/notes.c | |
| parent | 853488eed45f2f620fdfc4879827df02bc11553e (diff) | |
| download | libgit2-b60b4562feac6c17dde9159c437e6e5a908d628e.tar.gz | |
add option to allow git note overwrite
Diffstat (limited to 'src/notes.c')
| -rw-r--r-- | src/notes.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/notes.c b/src/notes.c index b49a1b524..c0ff48f7d 100644 --- a/src/notes.c +++ b/src/notes.c @@ -270,7 +270,8 @@ static int note_write(git_oid *out, const char *note, git_tree *commit_tree, const char *target, - git_commit **parents) + git_commit **parents, + int allow_note_overwrite) { int error; git_oid oid; @@ -283,7 +284,8 @@ static int note_write(git_oid *out, if ((error = manipulate_note_in_tree_r( &tree, repo, commit_tree, &oid, target, 0, - insert_note_in_tree_eexists_cb, insert_note_in_tree_enotfound_cb)) < 0) + allow_note_overwrite ? insert_note_in_tree_enotfound_cb : insert_note_in_tree_eexists_cb, + insert_note_in_tree_enotfound_cb)) < 0) goto cleanup; if (out) @@ -449,7 +451,8 @@ int git_note_create( const git_signature *committer, const char *notes_ref, const git_oid *oid, - const char *note) + const char *note, + int allow_note_overwrite) { int error; char *target = NULL; @@ -465,7 +468,7 @@ int git_note_create( goto cleanup; error = note_write(out, repo, author, committer, notes_ref, - note, tree, target, &commit); + note, tree, target, &commit, allow_note_overwrite); cleanup: git__free(target); |
