@Test public void testInstalledHook() { final URI newRepo = URI.create("git://hook-repo-name"); final FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); assertThat(fs).isNotNull(); if (fs instanceof JGitFileSystemImpl) { File[] hooks = new File(((JGitFileSystemImpl) fs).getGit().getRepository().getDirectory(), "hooks").listFiles(); assertThat(hooks).isNotEmpty().isNotNull(); assertThat(hooks.length).isEqualTo(2); boolean foundPreCommitHook = false; boolean foundPostCommitHook = false; for (File hook : hooks) { if (hook.getName().equals("pre-commit")) { foundPreCommitHook = hook.canExecute(); } else if (hook.getName().equals("post-commit")) { foundPostCommitHook = hook.canExecute(); } } assertThat(foundPreCommitHook).isTrue(); assertThat(foundPostCommitHook).isTrue(); } }
@Test public void testInstalledHook() { final URI newRepo = URI.create("git://hook-repo-name"); final FileSystem fs = provider.newFileSystem(newRepo, EMPTY_ENV); assertThat(fs).isNotNull(); if (fs instanceof JGitFileSystemImpl) { File[] hooks = new File(((JGitFileSystemImpl) fs).getGit().getRepository().getDirectory(), "hooks").listFiles(); assertThat(hooks).isNotEmpty().isNotNull(); assertThat(hooks.length).isEqualTo(2); boolean foundPreCommitHook = false; boolean foundPostCommitHook = false; for (File hook : hooks) { if (hook.getName().equals("pre-commit")) { foundPreCommitHook = hook.canExecute(); } else if (hook.getName().equals("post-commit")) { foundPostCommitHook = hook.canExecute(); } } assertThat(foundPreCommitHook).isTrue(); assertThat(foundPostCommitHook).isTrue(); } }
private boolean deleteFS(final FileSystem fileSystem) { final File gitDir = ((JGitFileSystemImpl) fileSystem).getGit().getRepository().getDirectory(); fileSystem.close(); fileSystem.dispose(); try { if (System.getProperty("os.name").toLowerCase().contains("windows")) { //this operation forces a cache clean freeing any lock -> windows only issue! WindowCache.reconfigure(new WindowCacheConfig()); } FileUtils.delete(gitDir, FileUtils.RECURSIVE | FileUtils.RETRY); fsManager.remove(fileSystem.getName()); cleanupParentDir(gitDir); return true; } catch (java.io.IOException e) { throw new IOException("Failed to remove the git repository.", e); } }
printLog(fs.getGit()); VersionRecord record = makeVersionRecord("aparedes", "aparedes@redhat.com", SquashOption.SQUASH_ATTR, squashOption); printLog(fs.getGit()); waitFor(threadsFinishedBarrier); }); printLog(fs.getGit()); VersionRecord record = makeVersionRecord("aparedes", "aparedes@redhat.com", SquashOption.SQUASH_ATTR, squashOption); printLog(fs.getGit()); waitFor(threadsFinishedBarrier); }); getCommitsFromBranch((GitImpl) fs.getGit(), "master").size());
printLog(fs.getGit()); VersionRecord record = makeVersionRecord("aparedes", "aparedes@redhat.com", SquashOption.SQUASH_ATTR, squashOption); printLog(fs.getGit()); waitFor(threadsFinishedBarrier); }); printLog(fs.getGit()); VersionRecord record = makeVersionRecord("aparedes", "aparedes@redhat.com", SquashOption.SQUASH_ATTR, squashOption); printLog(fs.getGit()); waitFor(threadsFinishedBarrier); }); getCommitsFromBranch((GitImpl) fs.getGit(), "master").size());