NativeGitConnection implements GitConnection { boolean isInsideWorkTree() throws GitException { final EmptyGitCommand emptyGitCommand = nativeGit.createEmptyGitCommand(); try { emptyGitCommand.setNextParameter("rev-parse") .setNextParameter("--is-inside-work-tree") .execute(); final String output = emptyGitCommand.getText(); return Boolean.valueOf(output); } catch (GitException ge) { String msg = ge.getMessage(); if (msg != null && notInGitRepoErrorPattern.matcher(msg).matches()) { return false; } throw ge; } } NativeGitConnection(File mountRoot, File repository, GitSshScriptProvider gitSshScriptProvider,
                               CredentialsLoader credentialsLoader);  NativeGitConnection(File mountRoot, NativeGit nativeGit, CredentialsLoader credentialsLoader); @Override File getWorkingDir(); @Override void add(AddRequest request); @Override void cloneWithSparseCheckout(String directory, String remoteUrl, String branch); @Override void checkout(CheckoutRequest request); @Override Branch branchCreate(BranchCreateRequest request); @Override void branchDelete(BranchDeleteRequest request); @Override void branchRename(String oldName, String newName); @Override List<Branch> branchList(BranchListRequest request); @Override List<String> listFiles(LsFilesRequest request); @Override void clone(CloneRequest request); @Override Revision commit(CommitRequest request); @Override DiffPage diff(DiffRequest request); @Override void fetch(FetchRequest request); @Override void init(InitRequest request); @Override LogPage log(LogRequest request); @Override List<RemoteReference> lsRemote(LsRemoteRequest request); @Override MergeResult merge(MergeRequest request); @Override RebaseResponse rebase(RebaseRequest request); @Override void mv(MoveRequest request); @Override PullResponse pull(PullRequest request); @Override PushResponse push(PushRequest request); @Override void remoteAdd(RemoteAddRequest request); @Override void remoteDelete(String name); @Override List<Remote> remoteList(RemoteListRequest request); @Override void remoteUpdate(RemoteUpdateRequest request); @Override void reset(ResetRequest request); @Override void rm(RmRequest request); @Override Status status(final StatusFormat format); @Override Tag tagCreate(TagCreateRequest request); @Override void tagDelete(TagDeleteRequest request); @Override List<Tag> tagList(TagListRequest request); @Override List<GitUser> getCommiters(); @Override Config getConfig(); @Override void close(); @Override void setOutputLineConsumerFactory(LineConsumerFactory gitOutputPublisherFactory);  }
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class) public void testNotGitRepo(GitConnectionFactory connectionFactory) throws GitException, IOException { File repository = Files.createTempDir(); NativeGitConnection connection = (NativeGitConnection)getTestUserConnection(connectionFactory, repository); assertFalse(connection.isInsideWorkTree()); }