8000 Example - will be deleted by jkelroy · Pull Request #6446 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

Example - will be deleted #6446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
checkout tests: nasty symlinks
Symbolic links that abuse case insensitivity to write into .git.
  • Loading branch information
ethomson authored and Edward Thomson committed Jan 19, 2015
commit 43ddf51a6f08d33db4777d688073be2dc4257ad7
40 changes: 39 additions & 1 deletion tests/checkout/nasty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��K
1D]�}���D�x/�O� NH"2�wo��=��5�e�@}�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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x�O[� ��S�4 R
Ic��z
۴�tb��K�7�k^�L&pJS%qS2�T�=5�1vo�4�5�t���z��u��QF�p�O�#\FNw^����H��v���V�����QT����F�ߩ�y
0O��u�y�$>��F�
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��]
�0�}�)�J�m���� ����`ӕQooo���70�x�9@%7e%k�h0���QAG�i�5�F�^����+�î��/0R�u�o�s;�y�E��ö������Bֈ�+;���9-��u���oG�
Expand Down
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions tests/resources/nasty/.gitted/refs/heads/symlink1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4d83272d0d372e1232ddc4ff3260d76fdfa2015a
1 change: 1 addition & 0 deletions tests/resources/nasty/.gitted/refs/heads/symlink2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9d5898503adc01d763e279ac8fcefbe865b19031
1 change: 1 addition & 0 deletions tests/resources/nasty/.gitted/refs/heads/symlink3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cf6fcf8cdf7e8d4cda3b11b0ba02d0d5125fbbd7
0