mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 15:10:02 +00:00
Merge pull request #1401 from carlosmn/leading-slash
refs: explicitly catch leading slashes
This commit is contained in:
commit
6a9ef01237
@ -1667,6 +1667,9 @@ int git_reference__normalize_name(
|
|||||||
process_flags = flags;
|
process_flags = flags;
|
||||||
current = (char *)name;
|
current = (char *)name;
|
||||||
|
|
||||||
|
if (*current == '/')
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (normalize)
|
if (normalize)
|
||||||
git_buf_clear(buf);
|
git_buf_clear(buf);
|
||||||
|
|
||||||
|
@ -32,6 +32,12 @@ void test_refs_lookup__with_resolve(void)
|
|||||||
git_reference_free(a);
|
git_reference_free(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_refs_lookup__invalid_name(void)
|
||||||
|
{
|
||||||
|
git_oid oid;
|
||||||
|
cl_git_fail(git_reference_name_to_id(&oid, g_repo, "/refs/tags/point_to_blob"));
|
||||||
|
}
|
||||||
|
|
||||||
void test_refs_lookup__oid(void)
|
void test_refs_lookup__oid(void)
|
||||||
{
|
{
|
||||||
git_oid tag, expected;
|
git_oid tag, expected;
|
||||||
|
Loading…
Reference in New Issue
Block a user