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
bad4937e
Commit
bad4937e
authored
Jul 21, 2014
by
Edward Thomson
Committed by
Edward Thomson
Oct 26, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce `git_note_author`, `git_note_committer`
parent
a612a25f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
4 deletions
+51
-4
include/git2/notes.h
+17
-0
src/notes.c
+31
-4
src/notes.h
+3
-0
No files found.
include/git2/notes.h
View file @
bad4937e
...
...
@@ -97,6 +97,23 @@ GIT_EXTERN(int) git_note_read(
const
git_oid
*
oid
);
/**
* Get the note author
*
* @param note the note
* @return the author
*/
GIT_EXTERN
(
const
git_signature
*
)
git_note_author
(
const
git_note
*
note
);
/**
* Get the note committer
*
* @param note the note
* @return the committer
*/
GIT_EXTERN
(
const
git_signature
*
)
git_note_committer
(
const
git_note
*
note
);
/**
* Get the note message
*
* @param note the note
...
...
src/notes.c
View file @
bad4937e
...
...
@@ -306,7 +306,11 @@ cleanup:
return
error
;
}
static
int
note_new
(
git_note
**
out
,
git_oid
*
note_oid
,
git_blob
*
blob
)
static
int
note_new
(
git_note
**
out
,
git_oid
*
note_oid
,
git_commit
*
commit
,
git_blob
*
blob
)
{
git_note
*
note
=
NULL
;
...
...
@@ -314,6 +318,11 @@ static int note_new(git_note **out, git_oid *note_oid, git_blob *blob)
GITERR_CHECK_ALLOC
(
note
);
git_oid_cpy
(
&
note
->
id
,
note_oid
);
if
(
git_signature_dup
(
&
note
->
author
,
git_commit_author
(
commit
))
<
0
||
git_signature_dup
(
&
note
->
committer
,
git_commit_committer
(
commit
))
<
0
)
return
-
1
;
note
->
message
=
git__strdup
((
char
*
)
git_blob_rawcontent
(
blob
));
GITERR_CHECK_ALLOC
(
note
->
message
);
...
...
@@ -323,7 +332,11 @@ static int note_new(git_note **out, git_oid *note_oid, git_blob *blob)
}
static
int
note_lookup
(
git_note
**
out
,
git_repository
*
repo
,
git_tree
*
tree
,
const
char
*
target
)
git_note
**
out
,
git_repository
*
repo
,
git_commit
*
commit
,
git_tree
*
tree
,
const
char
*
target
)
{
int
error
,
fanout
=
0
;
git_oid
oid
;
...
...
@@ -340,7 +353,7 @@ static int note_lookup(
if
((
error
=
git_blob_lookup
(
&
blob
,
repo
,
&
oid
))
<
0
)
goto
cleanup
;
if
((
error
=
note_new
(
&
note
,
&
oid
,
blob
))
<
0
)
if
((
error
=
note_new
(
&
note
,
&
oid
,
commit
,
blob
))
<
0
)
goto
cleanup
;
*
out
=
note
;
...
...
@@ -432,7 +445,7 @@ int git_note_read(git_note **out, git_repository *repo,
if
(
!
(
error
=
retrieve_note_tree_and_commit
(
&
tree
,
&
commit
,
repo
,
&
notes_ref
)))
error
=
note_lookup
(
out
,
repo
,
tree
,
target
);
error
=
note_lookup
(
out
,
repo
,
commit
,
tree
,
target
);
git__free
(
target
);
git_tree_free
(
tree
);
...
...
@@ -502,6 +515,18 @@ int git_note_default_ref(const char **out, git_repository *repo)
return
note_get_default_ref
(
out
,
repo
);
}
const
git_signature
*
git_note_committer
(
const
git_note
*
note
)
{
assert
(
note
);
return
note
->
committer
;
}
const
git_signature
*
git_note_author
(
const
git_note
*
note
)
{
assert
(
note
);
return
note
->
author
;
}
const
char
*
git_note_message
(
const
git_note
*
note
)
{
assert
(
note
);
...
...
@@ -519,6 +544,8 @@ void git_note_free(git_note *note)
if
(
note
==
NULL
)
return
;
git_signature_free
(
note
->
committer
);
git_signature_free
(
note
->
author
);
git__free
(
note
->
message
);
git__free
(
note
);
}
...
...
src/notes.h
View file @
bad4937e
...
...
@@ -23,6 +23,9 @@
struct
git_note
{
git_oid
id
;
git_signature
*
author
;
git_signature
*
committer
;
char
*
message
;
};
...
...
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