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
8e063eb6
Commit
8e063eb6
authored
Jun 23, 2018
by
Etienne Samson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples: make the refish resolution work with short OIDs
parent
8a629afe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
examples/common.c
+4
-3
No files found.
examples/common.c
View file @
8e063eb6
...
@@ -250,8 +250,8 @@ void *xrealloc(void *oldp, size_t newsz)
...
@@ -250,8 +250,8 @@ void *xrealloc(void *oldp, size_t newsz)
int
resolve_refish
(
git_annotated_commit
**
commit
,
git_repository
*
repo
,
const
char
*
refish
)
int
resolve_refish
(
git_annotated_commit
**
commit
,
git_repository
*
repo
,
const
char
*
refish
)
{
{
git_reference
*
ref
;
git_reference
*
ref
;
git_object
*
obj
;
int
err
=
0
;
int
err
=
0
;
git_oid
oid
;
assert
(
commit
!=
NULL
);
assert
(
commit
!=
NULL
);
...
@@ -262,9 +262,10 @@ int resolve_refish(git_annotated_commit **commit, git_repository *repo, const ch
...
@@ -262,9 +262,10 @@ int resolve_refish(git_annotated_commit **commit, git_repository *repo, const ch
return
0
;
return
0
;
}
}
err
=
git_
oid_fromstr
(
&
oid
,
refish
);
err
=
git_
revparse_single
(
&
obj
,
repo
,
refish
);
if
(
err
==
GIT_OK
)
{
if
(
err
==
GIT_OK
)
{
err
=
git_annotated_commit_lookup
(
commit
,
repo
,
&
oid
);
err
=
git_annotated_commit_lookup
(
commit
,
repo
,
git_object_id
(
obj
));
git_object_free
(
obj
);
}
}
return
err
;
return
err
;
...
...
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