checkout tests: nasty symlinks

Symbolic links that abuse case insensitivity to write into .git.
This commit is contained in:
Edward Thomson
2015-01-14 13:15:34 -05:00
committed by Edward Thomson
parent b4cbd67f5f
commit 232bc89598
18 changed files with 50 additions and 3 deletions

View File

@@ -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");
}

View File

@@ -1,2 +0,0 @@
xЅ<>a
!<14>ћэ)оZ|іt"іO'Ј <0B>>1Шз<>Н}н љ5ѓ Ь<>­КУЎ7ffV<66>)J<>CЄ9Y%UR<18>N~fc­gўйsmp<6D>/п"\s-k}Р<>§И<C2A7>ПХ/MЁ<4D> ЁqЄШьЅ<D18C>R :Ю;џ9#.wПцmzИ

View File

@@ -0,0 +1,2 @@
x¥<>K
1D]ç}¥“ÉDÜx/<2F> NH"2·woà®ê=¨Š5çe€@}<18>L<%´AD“Ì„VºI:%Ir§IDPÇüs̵Á-½|KpŸkîµÀ™vúIWúŠ_;Åš/À¥@Ç-WGTˆl§ûù ?gXñ}lзêºDX—ò`oÔ™Dù

View File

@@ -0,0 +1,4 @@
x¥O[Â ô4 R
Icüñz
Û´±t bÔÛK<C39B>7ðk^ÉL&pJS%qS2ô<>Tô=5­1vo•4Ñ5ƒt®÷zˆºu­þQFÎpŠOŸ#\FNw^ £ê®ìHßà§v<C2A7>Ó¤V袶°ÅQT·Žú³Fœß©çy
0OËèuyý$>…Fû

View File

@@ -0,0 +1,2 @@
x¥<>]
Â0„}Î)öJ²m“Šøâ ôùÙÐ`Ó•QoooàÛÌ70ÃxÎ9@%7e%h0ÒÇèœQAG­i­5èµF†^ ÂÞËÄ+ÃîÎç/0R¥u oðs;ÏyªE…ºÃ¶<C383>­ì¤•ÖñBÖˆÓ+;ž“‡9- çuæú©oG

View File

@@ -0,0 +1 @@
4d83272d0d372e1232ddc4ff3260d76fdfa2015a

View File

@@ -0,0 +1 @@
9d5898503adc01d763e279ac8fcefbe865b19031

View File

@@ -0,0 +1 @@
cf6fcf8cdf7e8d4cda3b11b0ba02d0d5125fbbd7