notes: move the notes name argument Make it consistent between git_note_create() and git_note_remote() by putting it after the repository.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7bc40c5..a2c2191 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -108,6 +108,9 @@ v0.21 + 1
* Introduce git_note_author() and git_note_committer() to get the author
and committer information on a git_note, respectively.
+* git_note_create() has changed the position of the notes reference
+ name to match git_note_remove().
+
* The THREADSAFE option to build libgit2 with threading support has
been flipped to be on by default.
diff --git a/include/git2/notes.h b/include/git2/notes.h
index 1a7794a..65ce548 100644
--- a/include/git2/notes.h
+++ b/include/git2/notes.h
@@ -135,10 +135,10 @@ GIT_EXTERN(const git_oid *) git_note_id(const git_note *note);
*
* @param out pointer to store the OID (optional); NULL in case of error
* @param repo repository where to store the note
- * @param author signature of the notes commit author
- * @param committer signature of the notes commit committer
* @param notes_ref canonical name of the reference to use (optional);
* defaults to "refs/notes/commits"
+ * @param author signature of the notes commit author
+ * @param committer signature of the notes commit committer
* @param oid OID of the git object to decorate
* @param note Content of the note to add for object oid
* @param force Overwrite existing note
@@ -148,9 +148,9 @@ GIT_EXTERN(const git_oid *) git_note_id(const git_note *note);
GIT_EXTERN(int) git_note_create(
git_oid *out,
git_repository *repo,
+ const char *notes_ref,
const git_signature *author,
const git_signature *committer,
- const char *notes_ref,
const git_oid *oid,
const char *note,
int force);
diff --git a/src/notes.c b/src/notes.c
index 4b15925..8fdf388 100644
--- a/src/notes.c
+++ b/src/notes.c
@@ -455,9 +455,9 @@ int git_note_read(git_note **out, git_repository *repo,
int git_note_create(
git_oid *out,
git_repository *repo,
+ const char *notes_ref,
const git_signature *author,
const git_signature *committer,
- const char *notes_ref,
const git_oid *oid,
const char *note,
int allow_note_overwrite)
diff --git a/src/rebase.c b/src/rebase.c
index 6453ecc..2681b3e 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -972,8 +972,8 @@ static int rebase_copy_note(
committer = who;
}
- error = git_note_create(¬e_id, rebase->repo, git_note_author(note),
- committer, opts->rewrite_notes_ref, to, git_note_message(note), 0);
+ error = git_note_create(¬e_id, rebase->repo, opts->rewrite_notes_ref,
+ git_note_author(note), committer, to, git_note_message(note), 0);
done:
git_note_free(note);
diff --git a/tests/notes/notes.c b/tests/notes/notes.c
index 8b1b578..d3b915e 100644
--- a/tests/notes/notes.c
+++ b/tests/notes/notes.c
@@ -34,7 +34,7 @@ static void create_note(git_oid *note_oid, const char *canonical_namespace, cons
git_oid oid;
cl_git_pass(git_oid_fromstr(&oid, target_sha));
- cl_git_pass(git_note_create(note_oid, _repo, _sig, _sig, canonical_namespace, &oid, message, 0));
+ cl_git_pass(git_note_create(note_oid, _repo, canonical_namespace, _sig, _sig, &oid, message, 0));
}
static struct {
@@ -195,12 +195,12 @@ void test_notes_notes__creating_a_note_on_a_target_which_already_has_one_returns
cl_git_pass(git_oid_fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
create_note(¬e_oid, NULL, "08b041783f40edfe12bb406c9c9a8a040177c125", "hello world\n");
- error = git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &target_oid, "hello world\n", 0);
+ error = git_note_create(¬e_oid, _repo, NULL, _sig, _sig, &target_oid, "hello world\n", 0);
cl_git_fail(error);
cl_assert_equal_i(GIT_EEXISTS, error);
create_note(¬e_oid, "refs/notes/some/namespace", "08b041783f40edfe12bb406c9c9a8a040177c125", "hello world\n");
- error = git_note_create(¬e_oid, _repo, _sig, _sig, "refs/notes/some/namespace", &target_oid, "hello world\n", 0);
+ error = git_note_create(¬e_oid, _repo, "refs/notes/some/namespace", _sig, _sig, &target_oid, "hello world\n", 0);
cl_git_fail(error);
cl_assert_equal_i(GIT_EEXISTS, error);
}
@@ -214,13 +214,13 @@ void test_notes_notes__creating_a_note_on_a_target_can_overwrite_existing_note(v
cl_git_pass(git_oid_fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
create_note(¬e_oid, NULL, "08b041783f40edfe12bb406c9c9a8a040177c125", "hello old world\n");
- cl_git_pass(git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &target_oid, "hello new world\n", 1));
+ cl_git_pass(git_note_create(¬e_oid, _repo, NULL, _sig, _sig, &target_oid, "hello new world\n", 1));
cl_git_pass(git_note_read(¬e, _repo, NULL, &target_oid));
assert_note_equal(note, "hello new world\n", ¬e_oid);
create_note(¬e_oid, "refs/notes/some/namespace", "08b041783f40edfe12bb406c9c9a8a040177c125", "hello old world\n");
- cl_git_pass(git_note_create(¬e_oid, _repo, _sig, _sig, "refs/notes/some/namespace", &target_oid, "hello new ref world\n", 1));
+ cl_git_pass(git_note_create(¬e_oid, _repo, "refs/notes/some/namespace", _sig, _sig, &target_oid, "hello new ref world\n", 1));
cl_git_pass(git_note_read(&namespace_note, _repo, "refs/notes/some/namespace", &target_oid));
assert_note_equal(namespace_note, "hello new ref world\n", ¬e_oid);
@@ -269,7 +269,7 @@ void test_notes_notes__can_insert_a_note_in_an_existing_fanout(void)
cl_git_pass(git_oid_fromstr(&target_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
for (i = 0; i < MESSAGES_COUNT; i++) {
- cl_git_pass(git_note_create(¬e_oid, _repo, _sig, _sig, "refs/notes/fanout", &target_oid, messages[i], 0));
+ cl_git_pass(git_note_create(¬e_oid, _repo, "refs/notes/fanout", _sig, _sig, &target_oid, messages[i], 0));
cl_git_pass(git_note_read(&_note, _repo, "refs/notes/fanout", &target_oid));
git_note_free(_note);
diff --git a/tests/notes/notesref.c b/tests/notes/notesref.c
index a59af20..11391e4 100644
--- a/tests/notes/notesref.c
+++ b/tests/notes/notesref.c
@@ -42,7 +42,7 @@ void test_notes_notesref__config_corenotesref(void)
cl_git_pass(git_config_set_string(_cfg, "core.notesRef", "refs/notes/mydefaultnotesref"));
- cl_git_pass(git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &oid, "test123test\n", 0));
+ cl_git_pass(git_note_create(¬e_oid, _repo, NULL, _sig, _sig, &oid, "test123test\n", 0));
cl_git_pass(git_note_read(&_note, _repo, NULL, &oid));
cl_assert_equal_s("test123test\n", git_note_message(_note));
diff --git a/tests/online/push.c b/tests/online/push.c
index 6424b5b..86862ee 100644
--- a/tests/online/push.c
+++ b/tests/online/push.c
@@ -863,7 +863,7 @@ void test_online_push__notes(void)
/* Create note to push */
cl_git_pass(git_signature_new(&signature, "nulltoken", "emeric.fermas@gmail.com", 1323847743, 60)); /* Wed Dec 14 08:29:03 2011 +0100 */
- cl_git_pass(git_note_create(¬e_oid, _repo, signature, signature, NULL, target_oid, "hello world\n", 0));
+ cl_git_pass(git_note_create(¬e_oid, _repo, NULL, signature, signature, target_oid, "hello world\n", 0));
do_push(specs, ARRAY_SIZE(specs),
exp_stats, ARRAY_SIZE(exp_stats),
@@ -895,7 +895,7 @@ void test_online_push__configured(void)
/* Create note to push */
cl_git_pass(git_signature_new(&signature, "nulltoken", "emeric.fermas@gmail.com", 1323847743, 60)); /* Wed Dec 14 08:29:03 2011 +0100 */
- cl_git_pass(git_note_create(¬e_oid, _repo, signature, signature, NULL, target_oid, "hello world\n", 0));
+ cl_git_pass(git_note_create(¬e_oid, _repo, NULL, signature, signature, target_oid, "hello world\n", 0));
do_push(NULL, 0,
exp_stats, ARRAY_SIZE(exp_stats),
diff --git a/tests/rebase/merge.c b/tests/rebase/merge.c
index e7eb167..0617771 100644
--- a/tests/rebase/merge.c
+++ b/tests/rebase/merge.c
@@ -416,9 +416,9 @@ static void test_copy_note(
branch_ref, GIT_OBJ_COMMIT));
/* Add a note to a commit */
- cl_git_pass(git_note_create(¬e_id, repo,
+ cl_git_pass(git_note_create(¬e_id, repo, "refs/notes/test",
git_commit_author(branch_commit), git_commit_committer(branch_commit),
- "refs/notes/test", git_commit_id(branch_commit),
+ git_commit_id(branch_commit),
"This is a commit note.", 0));
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, signature, opts));