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
7730fe8e
Commit
7730fe8e
authored
Nov 09, 2015
by
Edward Thomson
Committed by
Edward Thomson
Nov 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge: merge annotated commits instead of regular commits
parent
3f2bb387
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
10 deletions
+34
-10
src/annotated_commit.c
+32
-10
src/annotated_commit.h
+2
-0
src/merge.c
+0
-0
No files found.
src/annotated_commit.c
View file @
7730fe8e
...
...
@@ -8,6 +8,7 @@
#include "common.h"
#include "annotated_commit.h"
#include "refs.h"
#include "cache.h"
#include "git2/commit.h"
#include "git2/refs.h"
...
...
@@ -23,14 +24,17 @@ static int annotated_commit_init(
const
char
*
remote_url
)
{
git_annotated_commit
*
annotated_commit
;
git_commit
*
commit
=
NULL
;
int
error
=
0
;
assert
(
out
&&
id
);
*
out
=
NULL
;
annotated_commit
=
git__calloc
(
1
,
sizeof
(
git_annotated_commit
));
GITERR_CHECK_ALLOC
(
annotated_commit
);
if
((
error
=
git_commit_lookup
(
&
commit
,
repo
,
id
))
<
0
||
(
error
=
git_annotated_commit_from_commit
(
&
annotated_commit
,
commit
))
<
0
)
goto
done
;
if
(
ref_name
)
{
annotated_commit
->
ref_name
=
git__strdup
(
ref_name
);
...
...
@@ -42,15 +46,10 @@ static int annotated_commit_init(
GITERR_CHECK_ALLOC
(
annotated_commit
->
remote_url
);
}
git_oid_fmt
(
annotated_commit
->
id_str
,
id
);
annotated_commit
->
id_str
[
GIT_OID_HEXSZ
]
=
'\0'
;
if
((
error
=
git_commit_lookup
(
&
annotated_commit
->
commit
,
repo
,
id
))
<
0
)
{
git_annotated_commit_free
(
annotated_commit
);
return
error
;
}
*
out
=
annotated_commit
;
done:
git_commit_free
(
commit
);
return
error
;
}
...
...
@@ -96,6 +95,29 @@ int git_annotated_commit_from_head(
return
error
;
}
int
git_annotated_commit_from_commit
(
git_annotated_commit
**
out
,
git_commit
*
commit
)
{
git_annotated_commit
*
annotated_commit
;
assert
(
out
&&
commit
);
*
out
=
NULL
;
annotated_commit
=
git__calloc
(
1
,
sizeof
(
git_annotated_commit
));
GITERR_CHECK_ALLOC
(
annotated_commit
);
git_cached_obj_incref
(
commit
);
annotated_commit
->
commit
=
commit
;
git_oid_fmt
(
annotated_commit
->
id_str
,
git_commit_id
(
commit
));
annotated_commit
->
id_str
[
GIT_OID_HEXSZ
]
=
'\0'
;
*
out
=
annotated_commit
;
return
0
;
}
int
git_annotated_commit_lookup
(
git_annotated_commit
**
out
,
git_repository
*
repo
,
...
...
src/annotated_commit.h
View file @
7730fe8e
...
...
@@ -21,5 +21,7 @@ struct git_annotated_commit {
extern
int
git_annotated_commit_from_head
(
git_annotated_commit
**
out
,
git_repository
*
repo
);
extern
int
git_annotated_commit_from_commit
(
git_annotated_commit
**
out
,
git_commit
*
commit
);
#endif
src/merge.c
View file @
7730fe8e
This diff is collapsed.
Click to expand it.
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