mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
checkout tests: nasty symlinks
Symbolic links that abuse case insensitivity to write into .git.
This commit is contained in:
committed by
Edward Thomson
parent
b4cbd67f5f
commit
232bc89598
@@ -23,7 +23,29 @@ void test_checkout_nasty__cleanup(void)
|
||||
cl_git_sandbox_cleanup();
|
||||
}
|
||||
|
||||
void test_checkout_fails(const char *refname, const char *filename)
|
||||
static void test_checkout_passes(const char *refname, const char *filename)
|
||||
{
|
||||
git_oid commit_id;
|
||||
git_commit *commit;
|
||||
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||
git_buf path = GIT_BUF_INIT;
|
||||
|
||||
cl_git_pass(git_buf_joinpath(&path, repo_name, filename));
|
||||
|
||||
cl_git_pass(git_reference_name_to_id(&commit_id, repo, refname));
|
||||
cl_git_pass(git_commit_lookup(&commit, repo, &commit_id));
|
||||
|
||||
opts.checkout_strategy = GIT_CHECKOUT_FORCE |
|
||||
GIT_CHECKOUT_DONT_UPDATE_INDEX;
|
||||
|
||||
cl_git_pass(git_checkout_tree(repo, (const git_object *)commit, &opts));
|
||||
cl_assert(!git_path_exists(path.ptr));
|
||||
|
||||
git_commit_free(commit);
|
||||
git_buf_free(&path);
|
||||
}
|
||||
|
||||
static void test_checkout_fails(const char *refname, const char *filename)
|
||||
{
|
||||
git_oid commit_id;
|
||||
git_commit *commit;
|
||||
@@ -323,3 +345,19 @@ void test_checkout_nasty__honors_core_protectntfs(void)
|
||||
test_checkout_fails("refs/heads/dot_git_dot", ".git/foobar");
|
||||
test_checkout_fails("refs/heads/git_tilde1", ".git/foobar");
|
||||
}
|
||||
|
||||
void test_checkout_nasty__symlink1(void)
|
||||
{
|
||||
test_checkout_passes("refs/heads/symlink1", ".git/foobar");
|
||||
}
|
||||
|
||||
void test_checkout_nasty__symlink2(void)
|
||||
{
|
||||
test_checkout_passes("refs/heads/symlink2", ".git/foobar");
|
||||
}
|
||||
|
||||
void test_checkout_nasty__symlink3(void)
|
||||
{
|
||||
test_checkout_passes("refs/heads/symlink3", ".git/foobar");
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
xЅ<>a
|
||||
!<14>ћэ)оZ|іt"іO'Ј<0B>>1Шз<>Н}н љ5ѓ
Ь<>ZЪКУЎ7ffV<66>)J<>CЄ9Y%UR<18>N~fcgўйsmp<6D>/п"\s-k}Р<>§И<C2A7>ПХ/MЁ<4D> ЁqЄШьЅ<D18C>R:Ю;џ9#.wПцmzИ@Й
|
||||
@@ -0,0 +1,2 @@
|
||||
x¥<>K
|
||||
1D]ç}¥“ÉDÜx/<2F>OÃNH"2·woà®ê=¨Š5çe€@}<18>L<%´AD“Ì„VºI:%Ir§IDPÇüs̵Á-½|KpŸkîµÀ™vúIWúŠ_;Åš/À¥@Ç-WGTˆl§ûù ?gXñ}lзêºDX—ò`oÔ™Dù
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
x¥O[Â ô›Sì4R
|
||||
Icüñz
|
||||
Û´±t
bÔÛK<C39B>7ðk^ÉL&pJS%qS2ô<>Tô=51vo•4Ñ5ƒt®‚÷zˆºuþQFÎpŠOŸ#\FNw^ £ê®ìHßà§v<C2A7>Ó¤V袶°ÅQT·Žú³Fœß©çy
|
||||
0OËèu›yý$>›…Fû
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
x¥<>]
|
||||
Â0„}Î)öJ²m“Šøâ ôùÙÐ`Ó•QoooàÛÌ70ÃxÎ9@%7e%kúh0ÒÇèœQAGi5èµF†^
ÂÞËÄ+ÃîÎç/0R¥u oðs;ÏyªE…ºÃ¶<C383>줕ÖñBÖˆÓ+;ž“‡9- çuæú©oG‚
|
||||
Binary file not shown.
Binary file not shown.
1
tests/resources/nasty/.gitted/refs/heads/symlink1
Normal file
1
tests/resources/nasty/.gitted/refs/heads/symlink1
Normal file
@@ -0,0 +1 @@
|
||||
4d83272d0d372e1232ddc4ff3260d76fdfa2015a
|
||||
1
tests/resources/nasty/.gitted/refs/heads/symlink2
Normal file
1
tests/resources/nasty/.gitted/refs/heads/symlink2
Normal file
@@ -0,0 +1 @@
|
||||
9d5898503adc01d763e279ac8fcefbe865b19031
|
||||
1
tests/resources/nasty/.gitted/refs/heads/symlink3
Normal file
1
tests/resources/nasty/.gitted/refs/heads/symlink3
Normal file
@@ -0,0 +1 @@
|
||||
cf6fcf8cdf7e8d4cda3b11b0ba02d0d5125fbbd7
|
||||
Reference in New Issue
Block a user