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
add2dabb
Commit
add2dabb
authored
Jan 30, 2022
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revparse: support bare '@'
A bare '@' revision syntax represents HEAD. Support it as such.
parent
46885ac9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
src/revparse.c
+3
-0
tests/refs/revparse.c
+7
-0
No files found.
src/revparse.c
View file @
add2dabb
...
...
@@ -799,6 +799,9 @@ static int revparse(
if
(
temp_object
!=
NULL
)
base_rev
=
temp_object
;
break
;
}
else
if
(
spec
[
pos
+
1
]
==
'\0'
)
{
spec
=
"HEAD"
;
break
;
}
/* fall through */
...
...
tests/refs/revparse.c
View file @
add2dabb
...
...
@@ -881,3 +881,10 @@ void test_refs_revparse__uneven_sizes(void)
test_object
(
"a65fedf39aefe402d3bb6e24df4d"
,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750"
);
}
void
test_refs_revparse__parses_at_head
(
void
)
{
test_id
(
"HEAD"
,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750"
,
NULL
,
GIT_REVSPEC_SINGLE
);
test_id
(
"@{0}"
,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750"
,
NULL
,
GIT_REVSPEC_SINGLE
);
test_id
(
"@"
,
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750"
,
NULL
,
GIT_REVSPEC_SINGLE
);
}
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