Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
2bd5998c
Commit
2bd5998c
authored
Nov 27, 2012
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove git_note_data structure
parent
336d1275
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
25 deletions
+19
-25
include/git2/notes.h
+8
-14
src/notes.c
+3
-6
tests-clar/notes/notes.c
+8
-5
No files found.
include/git2/notes.h
View file @
2bd5998c
...
...
@@ -19,20 +19,15 @@
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
...
...
src/notes.c
View file @
2bd5998c
...
...
@@ -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
(
&
note_data
.
annotated_object_oid
,
buf
.
ptr
))
<
0
)
if
((
error
=
git_oid_fromstr
(
&
annotated_object_id
,
buf
.
ptr
))
<
0
)
goto
cleanup
;
git_oid_cpy
(
&
note_data
.
blob_oid
,
note_oid
);
if
(
note_cb
(
&
note_data
,
payload
))
if
(
note_cb
(
note_oid
,
&
annotated_object_id
,
payload
))
error
=
GIT_EUSER
;
cleanup:
...
...
tests-clar/notes/notes.c
View file @
2bd5998c
...
...
@@ -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
,
&
note_data
->
blob_o
id
)
==
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
,
&
note_data
->
annotated_object_o
id
)
==
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
)
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment