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
3b43c9d3
Commit
3b43c9d3
authored
Feb 14, 2023
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'revparse'
parents
632fe77d
c1634611
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
src/libgit2/revparse.c
+10
-1
tests/libgit2/refs/revparse.c
+3
-0
No files found.
src/libgit2/revparse.c
View file @
3b43c9d3
...
...
@@ -268,7 +268,16 @@ static int retrieve_revobject_from_reflog(git_object **out, git_reference **base
int
error
=
-
1
;
if
(
*
base_ref
==
NULL
)
{
if
((
error
=
git_reference_dwim
(
&
ref
,
repo
,
identifier
))
<
0
)
/*
* When HEAD@{n} is specified, do not use dwim, which would resolve the
* reference (to the current branch that HEAD is pointing to).
*/
if
(
position
>
0
&&
strcmp
(
identifier
,
GIT_HEAD_FILE
)
==
0
)
error
=
git_reference_lookup
(
&
ref
,
repo
,
GIT_HEAD_FILE
);
else
error
=
git_reference_dwim
(
&
ref
,
repo
,
identifier
);
if
(
error
<
0
)
return
error
;
}
else
{
ref
=
*
base_ref
;
...
...
tests/libgit2/refs/revparse.c
View file @
3b43c9d3
...
...
@@ -304,6 +304,9 @@ void test_refs_revparse__ordinal(void)
test_object
(
"@{0}"
,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750"
);
test_object
(
"@{1}"
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
);
test_object
(
"HEAD@{0}"
,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750"
);
test_object
(
"HEAD@{4}"
,
"5b5b025afb0b4c913b4c338a42934a3863bf3644"
);
test_object
(
"master@{0}"
,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750"
);
test_object
(
"master@{1}"
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
);
test_object
(
"heads/master@{1}"
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
);
...
...
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