diff options
| author | Nikolai Vladimirov <nikolay@vladimiroff.com> | 2013-01-03 16:31:36 +0200 |
|---|---|---|
| committer | Nikolai Vladimirov <nikolay@vladimiroff.com> | 2013-01-03 16:31:36 +0200 |
| commit | 8716b499e246496171aa8e9b84563b9486d66033 (patch) | |
| tree | ab70ff46732e081e74b3eb16f65295c92f31c68f /src/notes.c | |
| parent | 4a44087ae75a63ab0c10be215722a8a24f1187e7 (diff) | |
| download | libgit2-8716b499e246496171aa8e9b84563b9486d66033.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); |
