diff --git a/plugins/git4idea/testData/repo/community/current-branch.txt b/plugins/git4idea/testData/repo/community/current-branch.txt new file mode 100644 index 000000000000..4bac261f1e8d --- /dev/null +++ b/plugins/git4idea/testData/repo/community/current-branch.txt @@ -0,0 +1 @@ +c7c2a7bc37e16691070de8d7fb5dc52722a02fd5 135 diff --git a/plugins/git4idea/testData/repo/community/dot_git.zip b/plugins/git4idea/testData/repo/community/dot_git.zip new file mode 100644 index 000000000000..df7ac83eaabb Binary files /dev/null and b/plugins/git4idea/testData/repo/community/dot_git.zip differ diff --git a/plugins/git4idea/testData/repo/community/head.txt b/plugins/git4idea/testData/repo/community/head.txt new file mode 100644 index 000000000000..3c0f0fa9eb8e --- /dev/null +++ b/plugins/git4idea/testData/repo/community/head.txt @@ -0,0 +1 @@ +c7c2a7bc37e16691070de8d7fb5dc52722a02fd5 diff --git a/plugins/git4idea/testData/repo/community/local-branches.txt b/plugins/git4idea/testData/repo/community/local-branches.txt new file mode 100644 index 000000000000..de6f2c5d499f --- /dev/null +++ b/plugins/git4idea/testData/repo/community/local-branches.txt @@ -0,0 +1,6 @@ +d1a00cf3a95e344a880bf4b5721d31bde68f9b60 refs/heads/0a +0cb7fe9340c554daf76e98af3c53b84a20d8cdad refs/heads/133 +862405c26ea03129140428b340bdbb43c0cfebae refs/heads/133-conf +c7c2a7bc37e16691070de8d7fb5dc52722a02fd5 refs/heads/135 +3599f865ac39993ce6abfdb88b5fdc03432375e0 refs/heads/135_13.1 +6f6e2c02b51dec5e4706d09eb1e7333d32ed31d7 refs/heads/master \ No newline at end of file diff --git a/plugins/git4idea/testData/repo/community/remote-branches.txt b/plugins/git4idea/testData/repo/community/remote-branches.txt new file mode 100644 index 000000000000..1ba4502dae29 --- /dev/null +++ b/plugins/git4idea/testData/repo/community/remote-branches.txt @@ -0,0 +1,72 @@ +2a9d1157757358c48f2e9afc5b6c5cdb29832e2c refs/remotes/github/131 +d8526dc58dffdf3b4baabbf3bc0b360462be1835 refs/remotes/github/133 +2c9dff3e7efbdca9820dd680a6f9cb09e29f8463 refs/remotes/github/135 +26830787577ef0d0afc202780e2c0bda79d7dd3f refs/remotes/github/master +b11cc14e21271c85f5c26b32c4e035ed437dfa94 refs/remotes/origin/115 +72b37238bc1c4ff27dd262a70a88eccac0a2bf03 refs/remotes/origin/117 +8193f219a2be72643239fc225590af094f82aa4f refs/remotes/origin/119 +9a7667391da2f76ba1638033739b4ea5ba1098ef refs/remotes/origin/121 +4dad2e0bb535cdd8d53141db3d4303591b6696ac refs/remotes/origin/123 +5b8ebd3786786b9779db9c4dc7e7627002670cc4 refs/remotes/origin/125 +610591c694cf7a7c07ff2b4620308da9dfd069a5 refs/remotes/origin/127 +48cff86a8cfcc2b9ad0b1b4e81136c4e139a68a4 refs/remotes/origin/129 +2a9d1157757358c48f2e9afc5b6c5cdb29832e2c refs/remotes/origin/131 +ccc3ba3dd07e67df26c1427622f6fcf55ba2d60e refs/remotes/origin/133 +302379f5c74d5216fc8a44cb22351f0c36ca2fe9 refs/remotes/origin/133_13_0_1 +0d2d09952cb0ef2e532f1da3a3fc5dd348a7e588 refs/remotes/origin/135 +c9b333ebd82a05180f511679c0bb65ba4a7622e4 refs/remotes/origin/135_13.1 +09caa0cedbbb585f22aef8eb99dddbf3d48b199a refs/remotes/origin/EAP_validation +29c75d2664ea2dd791901f9f7b575a1d0228bafb refs/remotes/origin/a.zverev/indexes +b258a9044f58d353db59fdd19a4cbaaadea656b4 refs/remotes/origin/amarch-console +f87c9de49857639d1d336f735f538e784960fde8 refs/remotes/origin/amp/animator +5c26d66288652918751c3548f70278a8f9b62d6e refs/remotes/origin/amp/codereview +30160b297e891400e20f522139f8e766a7af828e refs/remotes/origin/amp/createPR-busy +5aa3feec2d1ebfad9e918a0bed0ecf0d9141b1e8 refs/remotes/origin/amp/two_factor_auth +892fd395ebf1d32e1cd9b2f2793ae876734174f3 refs/remotes/origin/appcode10 +4994baefe42646609ed2ada94344956de0b576b9 refs/remotes/origin/chromium-sdk-jb +fa92c26eae24b6b2f8de8c18bfbfb316df05e6a1 refs/remotes/origin/customDfaAssert +f5b464e66d40e51d31efc7038bd562316c738202 refs/remotes/origin/denis.zhdanov/129/gradle +f1e0a410dc76b7e0dc597499808f81d573b4e8d5 refs/remotes/origin/develar-debugger-sdk +87c3f92084d9af181b479ca46c58d908df405e2b refs/remotes/origin/develar-netty4 +c1b8de29b8ac9d825ec561db270d6b26be707f83 refs/remotes/origin/extBackedChromeConnection +2e5fc113f94a56073855bf585d5a0a98b59b7dd0 refs/remotes/origin/feature/FileNameCache +e740190d3435741acc08747806117efc994c2108 refs/remotes/origin/feature/IgnoredFileCache +3a95d13d0fba8418cbe8b82241b12263cae411b9 refs/remotes/origin/foreach-debug +26547c4fdd09a9db28226ac1b97f3c4b68bc0cc0 refs/remotes/origin/idea10 +ca996ad22c28037521fe6e4464378212916c78fb refs/remotes/origin/idea90 +f39085225cfb169bb5ac1e71865dd1305b8c8874 refs/remotes/origin/idea9beta +70b724da540bc9b6c9d33ce5a1fea80cbef33c9c refs/remotes/origin/json-support +d814936cd0fb293a9c32a953c6be75c7ddd1e566 refs/remotes/origin/ksafonov-flex-refactorings +2bfda300b54bd9d1fa6eb4e70c3641b02e40dbd5 refs/remotes/origin/log/bek +810c415378e6f45da237de217679d34b94054545 refs/remotes/origin/log/blackbox +b545377925c25f4881c5cf6a230a439aa0571f21 refs/remotes/origin/log/new-graph-api +fc7806c69cd86d743f0c29e9f5c6adb18f3c86b5 refs/remotes/origin/loki/ansi +6410ca892101ff56d49cd6ada70187b7912f2024 refs/remotes/origin/loki/diff-lens +4cd7cfecb510e84ad7d9761972b912e765360337 refs/remotes/origin/loki/new-push +c2d4f05918ba5d8fec12df59d771ff4c88a133a1 refs/remotes/origin/loki/newlog +048ca228d826ebf4f0ad842304c354d432a2dd3f refs/remotes/origin/loki/repo-events +83f6e6cbc9f34392d6517f16d9935772c7ac97ac refs/remotes/origin/loki/revert +2fd991f860f0a3ca31f8205246a3e36abb88f28c refs/remotes/origin/maia +6f6e2c02b51dec5e4706d09eb1e7333d32ed31d7 refs/remotes/origin/master +5712e8396959f82fb578b882dcbefb5ece5666fb refs/remotes/origin/maven +067c0ff98138d37c7a611af51c1eb407fd5977b3 refs/remotes/origin/nadya +e9902fc5a37bcda923acfaaaa6ec3e2bd9d5fc0c refs/remotes/origin/new-flex-config +0b5aa8e7be290928f89118df1c483f656b55d052 refs/remotes/origin/nika +9290322a00c3cf569ff459d9527a33550f08e549 refs/remotes/origin/pycharm10 +5b167908c701c303af68d10bd3f43ab0970c9011 refs/remotes/origin/pycharm11 +35ad3def2e38be70b608d355b98bd07840b814a6 refs/remotes/origin/pycharm12 +a4672c12347e78f30de87d40a5c42d854c9e7e85 refs/remotes/origin/rearranger_sections +f2ae394f419ac20445ffcd3bca8ea80100bba922 refs/remotes/origin/refactoring_bp +e243c5f68389c5382d873d741febbed09a75aa31 refs/remotes/origin/roman.chernyatchik/rcov +1e4ee5c2cc9207490bd0581a76638caff2485107 refs/remotes/origin/rubymine20 +b88824bb6406f5e7ea7f79014dbf5d37af9ea1f3 refs/remotes/origin/rubymine25 +3b1e52c93369d3e17a53bdab7233e988bc21ff4b refs/remotes/origin/swig_lldb_driver +e136ab96bed7ffd5baabc68788930efd2b4d65e2 refs/remotes/origin/tohi +45032277432ce4b0f151e565faa5062a4bb68e3e refs/remotes/origin/upsource-master +38191c7fb1a21a38c51b82da6d2dd6ff32187eb2 refs/remotes/origin/v.orlov/bp-refactoring +0642e595bd9ae2b924fdf4d12606cbc03389e777 refs/remotes/origin/webide1 +5c9aff686a422a875730f7e22e642edfa85b36c9 refs/remotes/origin/x0x +c8f09779f4f048494767896771feea5abb1d1114 refs/remotes/origin/xena +bdf8fb13428078c7d6e0cb52eb481450bd950b50 refs/remotes/origin/ysz/idea-113656 +eed8f8638ba183cbc5eba06d9f55ecb10f232655 refs/remotes/origin/zajac-center-editor +bca52c64ed363e23231d23bf8423b3accde1981f refs/remotes/origin/zajac-navigation-tab \ No newline at end of file diff --git a/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java b/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java index 89229c5c7247..e6f40f1da782 100644 --- a/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java +++ b/plugins/git4idea/tests/git4idea/repo/GitRepositoryReaderTest.java @@ -5,6 +5,7 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.VcsTestUtil; import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.io.ZipUtil; import com.intellij.vcs.log.impl.HashImpl; import git4idea.GitBranch; import git4idea.GitLocalBranch; @@ -14,6 +15,7 @@ import junit.framework.TestCase; import org.jetbrains.annotations.NotNull; import java.io.File; +import java.io.FileFilter; import java.io.IOException; import java.util.Collection; import java.util.List; @@ -31,16 +33,22 @@ public class GitRepositoryReaderTest extends GitPlatformTest { super.setUp(); myTempDir = new File(myProjectRoot.getPath(), "test"); - myTempDir.mkdir(); File pluginRoot = new File(PluginPathManager.getPluginHomePath("git4idea")); myDataDir = new File(new File(pluginRoot, "testData"), "repo"); } private void prepareTest(File testDir) throws IOException { + assertTrue("Temp directory was not created", myTempDir.mkdir()); FileUtil.copyDir(testDir, myTempDir); myGitDir = new File(myTempDir, ".git"); - FileUtil.rename(new File(myTempDir, "dot_git"), myGitDir); + File dotGit = new File(myTempDir, "dot_git"); + if (!dotGit.exists()) { + File dotGitZip = new File(myTempDir, "dot_git.zip"); + assertTrue("Neither dot_git nor dot_git.zip were found", dotGitZip.exists()); + ZipUtil.extract(dotGitZip, myTempDir, null); + } + FileUtil.rename(dotGit, myGitDir); TestCase.assertTrue(myGitDir.exists()); myRepositoryReader = new GitRepositoryReader(myGitDir); } @@ -51,15 +59,23 @@ public class GitRepositoryReaderTest extends GitPlatformTest { } private void doTest(@NotNull ResultConsumer test) throws Exception { - for (File dir : myDataDir.listFiles()) { - if (!dir.isDirectory()) { - continue; + File[] files = myDataDir.listFiles(new FileFilter() { + @Override + public boolean accept(File file) { + return file.isDirectory(); } + }); + for (File dir : files) { prepareTest(dir); test.consume(dir); + cleanupTest(); } } + private void cleanupTest() { + FileUtil.delete(myTempDir); + } + @NotNull private static String readHead(@NotNull File dir) throws IOException { return FileUtil.loadFile(new File(dir, "head.txt")).trim();