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
5912d74c
Commit
5912d74c
authored
Oct 18, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revparse: properly handle refnames containing a @
Fix #994
parent
b2b571ce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
src/revparse.c
+4
-0
tests-clar/refs/isvalidname.c
+1
-0
tests-clar/refs/revparse.c
+34
-0
No files found.
src/revparse.c
View file @
5912d74c
...
...
@@ -795,6 +795,7 @@ int git_revparse_single(git_object **out, git_repository *repo, const char *spec
case
'@'
:
{
if
(
spec
[
pos
+
1
]
==
'{'
)
{
git_object
*
temp_object
=
NULL
;
if
((
error
=
extract_curly_braces_content
(
&
buf
,
spec
,
&
pos
))
<
0
)
...
...
@@ -809,6 +810,9 @@ int git_revparse_single(git_object **out, git_repository *repo, const char *spec
if
(
temp_object
!=
NULL
)
base_rev
=
temp_object
;
break
;
}
else
{
/* Fall through */
}
}
default:
...
...
tests-clar/refs/isvalidname.c
View file @
5912d74c
...
...
@@ -20,4 +20,5 @@ void test_refs_isvalidname__wont_hopefully_choke_on_valid_formats(void)
cl_assert_equal_i
(
true
,
git_reference_is_valid_name
(
"HEAD"
));
cl_assert_equal_i
(
true
,
git_reference_is_valid_name
(
"ONE_LEVEL"
));
cl_assert_equal_i
(
true
,
git_reference_is_valid_name
(
"refs/stash"
));
cl_assert_equal_i
(
true
,
git_reference_is_valid_name
(
"refs/remotes/origin/bim_with_3d@11296"
));
}
tests-clar/refs/revparse.c
View file @
5912d74c
...
...
@@ -451,3 +451,37 @@ void test_refs_revparse__a_too_short_objectid_returns_EAMBIGUOUS(void)
cl_assert_equal_i
(
GIT_EAMBIGUOUS
,
result
);
}
void
test_refs_revparse__issue_994
(
void
)
{
git_repository
*
repo
;
git_reference
*
head
,
*
with_at
;
git_object
*
target
;
repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_revparse_single
(
&
target
,
repo
,
"origin/bim_with_3d@11296"
));
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_revparse_single
(
&
target
,
repo
,
"refs/remotes/origin/bim_with_3d@11296"
));
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_reference_create_oid
(
&
with_at
,
repo
,
"refs/remotes/origin/bim_with_3d@11296"
,
git_reference_oid
(
head
),
0
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"origin/bim_with_3d@11296"
));
git_object_free
(
target
);
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"refs/remotes/origin/bim_with_3d@11296"
));
git_object_free
(
target
);
git_reference_free
(
with_at
);
git_reference_free
(
head
);
cl_git_sandbox_cleanup
();
}
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