Skip to content

Add support for worktrees #1607

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

Merged
merged 15 commits into from
Dec 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ _ReSharper*/
*.DotSettings

_NCrunch_LibGit2Sharp/
packages/
worktree.playlist
1 change: 1 addition & 0 deletions LibGit2Sharp.Tests/Resources/worktree/testrepo_wd/1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
one
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hi
1 change: 1 addition & 0 deletions LibGit2Sharp.Tests/Resources/worktree/testrepo_wd/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hey there
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add "1.txt" file beside "1" folder
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/master
23 changes: 23 additions & 0 deletions LibGit2Sharp.Tests/Resources/worktree/testrepo_wd/dot_git/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = c:/GitHub/libgit2sharp/Resources/testrepo.git
[remote "no_url"]
url =
fetch = +refs/heads/*:refs/remotes/no_url/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "track-local"]
remote = .
merge = refs/heads/master
[unittests]
longsetting = 15234
intsetting = 2
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0000000000000000000000000000000000000000 4c062a6361ae6959e06292c1fa5e2822d9c96345 Tim Clem <timothy.clem@gmail.com> 1303768198 -0700 clone: from c:/GitHub/libgit2sharp/Resources/testrepo.git
4c062a6361ae6959e06292c1fa5e2822d9c96345 592d3c869dbc4127fc57c189cb94f2794fa84e7e Tim Clem <timothy.clem@gmail.com> 1303835722 -0700 commit: add more test files
592d3c869dbc4127fc57c189cb94f2794fa84e7e 32eab9cb1f450b5fe7ab663462b77d7f4b703344 nulltoken <emeric.fermas@gmail.com> 1320047537 +0100 commit: Add "1.txt" file beside "1" folder
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0000000000000000000000000000000000000000 4c062a6361ae6959e06292c1fa5e2822d9c96345 nulltoken <emeric.fermas@gmail.com> 1359021419 +0100 branch: Created from 4c062a6361ae6959e06292c1fa5e2822d9c96345
4c062a6361ae6959e06292c1fa5e2822d9c96345 a447ba2ca8fffd46dece72f7db6faf324afb8fcd nulltoken <emeric.fermas@gmail.com> 1359021433 +0100 commit: Add logo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0000000000000000000000000000000000000000 4c062a6361ae6959e06292c1fa5e2822d9c96345 Tim Clem <timothy.clem@gmail.com> 1303768198 -0700 clone: from c:/GitHub/libgit2sharp/Resources/testrepo.git
4c062a6361ae6959e06292c1fa5e2822d9c96345 592d3c869dbc4127fc57c189cb94f2794fa84e7e Tim Clem <timothy.clem@gmail.com> 1303835722 -0700 commit: add more test files
592d3c869dbc4127fc57c189cb94f2794fa84e7e 32eab9cb1f450b5fe7ab663462b77d7f4b703344 nulltoken <emeric.fermas@gmail.com> 1320047537 +0100 commit: Add "1.txt" file beside "1" folder
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̱
1EQ����jm\�,��Dl,'�Ä���:"���큛�3���^4�7�u�و� �\0yVg��(W����ϝ�XmL?�2��ʍj�K=yPK™��I� �#Y
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x��]j!���)�} �?�!d��m�+�qq]���3䥠>����Z�������&�0�M1h�}�V��v�Y+��.a�9�z�4�O� *�LGxx��d�V�ðc^����Zg�����(�e-<n-��Qo߀kBg��O�R�E������5%��6��r� ��%�b���x�7G�P
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��Q
�0D��)��6�ͦ "xO���-�Fb��Eo��0 �Ǥ�,ske�[�Pn8R,EpD?�g�}�^3� ��<��G�hYK���8ЖDA��)���;g�ݧ���j�p�4����-������r���;�s�GA4ۺ=���(�in7�I�K�FE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��K
1D]�� C�����tg&`&������Q��VkQ�Fg��au����xved��0Sr.�y�J��!'C^!� @�`2�,�@ ����(�{��O�i��_�eO������\�V�Ra����g�)�:��w>R-�&�B�Ey
Expand Down
Binary file not shown.
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��Aj1 E��)t�{d[6��Ev���G� �ep�}B{��><x�_zk� �0vU@������X��T"��B�dS%
�8�û�����"z4pq1&�Y�% %��~���p�u,p�e�'��߽}~7^����:��gB8�`�y��á�q͗�>�����B0��I�
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��� 1E�Ni@��k2 "X�$�YW0Yc����Ås���z����MD��0��8!�����s� X��g�d�::@X0�P�w�"F/����R��Uz��m�ZZ�����V}|�/�o5����I�!�1z��:v��Uim}�/�>
�F-
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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��A
� E���/c�J�=�8�TA#�]��M�����ϭ�<��p]�_��*�6t�<�0�l��z�8�+[�U�k����:%X�S�D�J���Y)��[����Y�4"�5j�z<��U�=�L~�6u;=
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x��[
�0E��*f��դ "�W0��-�F�t�݁��pS[�Y��x�^
D�b CLhut��}�8X*4Z��sY���U��A���X3�R�M��) s6輢M��រ�&Jm��;}�����<��\@����ޏpĀ�v�?��jۺL��?H�
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��;j1D��md�����ǎ|M��3`��V{ >���Q����vL0I?�!�4�Z=�!�צ8�F���!r�sQ�y�9�]$D�&�l6A�>jFW�ҵ IKNi��Z�%�S���
�� ������U~̽��>'��� �w��[��� ���DGڡ���Q-�M���>d���O����}�\�8g_Ш�oYr
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��M
�0F]�� e���D�z�q��@�@� oo� ����{��Rr��é���� �1��EȀKƀ��<�|���V�~�ƛ�|�L��|ܞ��>I-W�s���@�Ԡ��\"K�Z ���G�w����:�
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x�A
�0�a�9��I� ���p'�1�Ѷ�v\x{c���V�p�vW�g��ǎ0x�[ ]"g�#{rD�Cot ���N �U $��?9-p+1�^��Qx���9O\�C�� �m�'D{m�V��(+���l��,�
Expand Down
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,3 @@
x��Kj1D��)z�UB��-0��uV9����<#������+�W<J���&8�/s��e���ȕKJ����S
�Rv��{��Q��r��Y�QN$H\E����=6�X5���K Fr)�(�dC��Ά�����j�s�}���9�c-�w8�o�\�r��I���:
l}F�W$Ds�ǣ��ٚOW�e�]V8-Ý��"U
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x��Q
�0D��)�ʦ�I<�'�lR+�Fj��Eo��0<x�h���a ���]ș��XUl�PF)�z�4y�,\r 'S��-mI4
�Xh��&��F�}n+\���Y�-p|鷜oU�z;-��a��lt{��?�I�,:�o�R��cHK
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��A
� E���/G�!�n{�q2��F����t���{�k)�:�M��^x��L����� ����ݚ�̛�W����6��~� �Z�����P��r4�-3��Qku���?�z�'����9�;I
Binary file not shown.
Binary file not shown.
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 @@
x��KJ1Eg5s <*�t> ��e���^7t:�wo܂� �p��@.=�..nD�"�JH�q�D��V1�����t��U�e�ޕ�in���� afu9Fk�c��O�e�׿����*�q��k9����rL��^�"����!�a���y�%_����2f��w3�G_K�
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x�A@0P��[�!���N�����#����ϋz�]�ld���uE/�D�nD�T$�h��Xϼ���z�p0(=��bhj73�|e�~#[�
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x��A
�0E]���$�� ����f�L#1���
�>�ǃ?��Sc��U`=J�'�Dd�Q�)xF�DG��ު'W�D�¨���0x2L�-Z�#�q��b�m->��
���n�呶ے9=���+h�G7B�3jDu��a�ZuO�-�[�W�cT_�FHn
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x���B!D=Sh؅�Bb�;�X�G��c�|�/��K�d��z-�FѲDXy) Y�1��������X4��z�.�����r�dv�4Mb�st+Ҍ���������S/�zkuk}�I�\�����q�VOl�m ����Q�ΣC��Pp���1�J�
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,10 @@
# pack-refs with: peeled
b25fa35b38051e4ae45d4222e795f9df2e43f1d1 refs/tags/test
^e90810b8df3e80c413d903f631643c716887138d
e90810b8df3e80c413d903f631643c716887138d refs/tags/lw
7b4384978d2493e851f9cca7858815fac9b10980 refs/tags/e90810b
^e90810b8df3e80c413d903f631643c716887138d
e90810b8df3e80c413d903f631643c716887138d refs/remotes/origin/test
4a202b346bb0fb0db7eff3cffeb3c70babbd2045 refs/remotes/origin/packed-test
580c2111be43802dab11328176d94c391f1deae9 refs/remotes/origin/master
a4a7dce85cf63874e984719f4fdd239f5145052f refs/remotes/origin/br2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e7039e6d0e7dd4d4c1e2e8e5aa5306b2776436ca
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7252fe2da2c4dd6d85231a150d0485ec46abaa7a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a447ba2ca8fffd46dece72f7db6faf324afb8fcd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
32eab9cb1f450b5fe7ab663462b77d7f4b703344
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
580c2111be43802dab11328176d94c391f1deae9
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f705abffe7015f2beacf2abe7a36583ebee3487e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/remotes/origin/master
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/i-do-numbers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7252fe2da2c4dd6d85231a150d0485ec46abaa7a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../..
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../../../worktrees/i-do-numbers/.git
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7252fe2da2c4dd6d85231a150d0485ec46abaa7a 7252fe2da2c4dd6d85231a150d0485ec46abaa7a Mike Minns <mminns@itofinity.co.uk> 1513714384 +0000 reset: moving to HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/logo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a447ba2ca8fffd46dece72f7db6faf324afb8fcd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../..
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../../../worktrees/logo/.git
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test lock reason
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a447ba2ca8fffd46dece72f7db6faf324afb8fcd a447ba2ca8fffd46dece72f7db6faf324afb8fcd Mike Minns <mminns@itofinity.co.uk> 1513713776 +0000 reset: moving to HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a change
more files!
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
some more text
more files! more files!
1 change: 1 addition & 0 deletions LibGit2Sharp.Tests/Resources/worktree/testrepo_wd/new.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
my new file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a new file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
content
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gitdir: ../../testrepo_wd/.git/worktrees/i-do-numbers
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1
2
3
4
5
6
7
7.2
8
9
10
11
12
13
14
15
16
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
That's a terrible name!
I don't like it.
People look down at me and laugh. :-(
Really!!!!
Yeah! Better!
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hey there
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gitdir: ../../testrepo_wd/.git/worktrees/logo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
my new file
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ static BaseFixture()
private static string SubmoduleTargetTestRepoWorkingDirPath { get; set; }
private static string AssumeUnchangedRepoWorkingDirPath { get; set; }
public static string SubmoduleSmallTestRepoWorkingDirPath { get; set; }
public static string WorktreeTestRepoWorkingDirPath { get; private set; }
public static string WorktreeTestRepoWorktreesDirPath { get; private set; }
public static string PackBuilderTestRepoPath { get; private set; }

public static DirectoryInfo ResourcesDirectory { get; private set; }
Expand Down Expand Up @@ -85,6 +87,8 @@ private static void SetUpTestEnvironment()
AssumeUnchangedRepoWorkingDirPath = Path.Combine(ResourcesDirectory.FullName, "assume_unchanged_wd");
SubmoduleSmallTestRepoWorkingDirPath = Path.Combine(ResourcesDirectory.FullName, "submodule_small_wd");
PackBuilderTestRepoPath = Path.Combine(ResourcesDirectory.FullName, "packbuilder_testrepo_wd");
WorktreeTestRepoWorkingDirPath = Path.Combine(ResourcesDirectory.FullName, "worktree", "testrepo_wd");
WorktreeTestRepoWorktreesDirPath = Path.Combine(ResourcesDirectory.FullName, "worktree", "worktrees");

CleanupTestReposOlderThan(TimeSpan.FromMinutes(15));
}
Expand Down Expand Up @@ -220,6 +224,11 @@ public string SandboxSubmoduleSmallTestRepo()
return path;
}

public string SandboxWorktreeTestRepo()
{
return Sandbox(WorktreeTestRepoWorkingDirPath, WorktreeTestRepoWorktreesDirPath);
}

protected string SandboxPackBuilderTestRepo()
{
return Sandbox(PackBuilderTestRepoPath);
Expand Down
Loading