mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-01 23:50:11 +00:00
Remove git_note_data structure
This commit is contained in:
parent
336d1275ca
commit
2bd5998c9c
@ -18,21 +18,16 @@
|
||||
*/
|
||||
GIT_BEGIN_DECL
|
||||
|
||||
/**
|
||||
* Basic components of a note
|
||||
*
|
||||
* - Oid of the blob containing the message
|
||||
* - Oid of the git object being annotated
|
||||
*/
|
||||
typedef struct {
|
||||
git_oid blob_oid;
|
||||
git_oid annotated_object_oid;
|
||||
} git_note_data;
|
||||
|
||||
/**
|
||||
* Callback for git_note_foreach.
|
||||
*
|
||||
* Receives:
|
||||
* - blob_id: Oid of the blob containing the message
|
||||
* - annotated_object_id: Oid of the git object being annotated
|
||||
* - payload: Payload data passed to `git_note_foreach`
|
||||
*/
|
||||
typedef int (*git_note_foreach_cb)(git_note_data *note_data, void *payload);
|
||||
typedef int (*git_note_foreach_cb)(
|
||||
const git_oid *blob_id, const git_oid *annotated_object_id, void *payload);
|
||||
|
||||
/**
|
||||
* Read the note for an object
|
||||
@ -150,8 +145,7 @@ GIT_EXTERN(int) git_note_foreach(
|
||||
git_repository *repo,
|
||||
const char *notes_ref,
|
||||
git_note_foreach_cb note_cb,
|
||||
void *payload
|
||||
);
|
||||
void *payload);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
|
@ -534,7 +534,7 @@ static int process_entry_path(
|
||||
int error = -1;
|
||||
size_t i = 0, j = 0, len;
|
||||
git_buf buf = GIT_BUF_INIT;
|
||||
git_note_data note_data;
|
||||
git_oid annotated_object_id;
|
||||
|
||||
if ((error = git_buf_puts(&buf, entry_path)) < 0)
|
||||
goto cleanup;
|
||||
@ -567,13 +567,10 @@ static int process_entry_path(
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((error = git_oid_fromstr(
|
||||
¬e_data.annotated_object_oid, buf.ptr)) < 0)
|
||||
if ((error = git_oid_fromstr(&annotated_object_id, buf.ptr)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
git_oid_cpy(¬e_data.blob_oid, note_oid);
|
||||
|
||||
if (note_cb(¬e_data, payload))
|
||||
if (note_cb(note_oid, &annotated_object_id, payload))
|
||||
error = GIT_EUSER;
|
||||
|
||||
cleanup:
|
||||
|
@ -50,7 +50,8 @@ static struct {
|
||||
|
||||
#define EXPECTATIONS_COUNT (sizeof(list_expectations)/sizeof(list_expectations[0])) - 1
|
||||
|
||||
static int note_list_cb(git_note_data *note_data, void *payload)
|
||||
static int note_list_cb(
|
||||
const git_oid *blob_id, const git_oid *annotated_obj_id, void *payload)
|
||||
{
|
||||
git_oid expected_note_oid, expected_target_oid;
|
||||
|
||||
@ -59,10 +60,10 @@ static int note_list_cb(git_note_data *note_data, void *payload)
|
||||
cl_assert(*count < EXPECTATIONS_COUNT);
|
||||
|
||||
cl_git_pass(git_oid_fromstr(&expected_note_oid, list_expectations[*count].note_sha));
|
||||
cl_assert(git_oid_cmp(&expected_note_oid, ¬e_data->blob_oid) == 0);
|
||||
cl_assert(git_oid_cmp(&expected_note_oid, blob_id) == 0);
|
||||
|
||||
cl_git_pass(git_oid_fromstr(&expected_target_oid, list_expectations[*count].annotated_object_sha));
|
||||
cl_assert(git_oid_cmp(&expected_target_oid, ¬e_data->annotated_object_oid) == 0);
|
||||
cl_assert(git_oid_cmp(&expected_target_oid, annotated_obj_id) == 0);
|
||||
|
||||
(*count)++;
|
||||
|
||||
@ -103,11 +104,13 @@ void test_notes_notes__can_retrieve_a_list_of_notes_for_a_given_namespace(void)
|
||||
cl_assert_equal_i(4, retrieved_notes);
|
||||
}
|
||||
|
||||
static int note_cancel_cb(git_note_data *note_data, void *payload)
|
||||
static int note_cancel_cb(
|
||||
const git_oid *blob_id, const git_oid *annotated_obj_id, void *payload)
|
||||
{
|
||||
unsigned int *count = (unsigned int *)payload;
|
||||
|
||||
GIT_UNUSED(note_data);
|
||||
GIT_UNUSED(blob_id);
|
||||
GIT_UNUSED(annotated_obj_id);
|
||||
|
||||
(*count)++;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user