From c99e801a6920e2bb35a73e1222a52d3fb24a0a92 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 2 Jun 2018 11:08:25 +0100 Subject: [PATCH] When opening a repo in a dir that is a bare repo then GitDb is returned --- src/test/java/net/kemitix/gitdb/GitDBTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/net/kemitix/gitdb/GitDBTest.java b/src/test/java/net/kemitix/gitdb/GitDBTest.java index 4258683..4a18fe6 100644 --- a/src/test/java/net/kemitix/gitdb/GitDBTest.java +++ b/src/test/java/net/kemitix/gitdb/GitDBTest.java @@ -150,6 +150,21 @@ class GitDBTest implements WithAssertions { } // When opening a repo in a dir that is a bare repo then GitDb is returned + @Test + void openRepo_whenGitDB_thenReturnGitDB() throws IOException { + //given + final Path dir = gitDBRepo(); + //when + final GitDBLocal gitDB = GitDB.openLocal(dir); + //then + assertThat(gitDB).isNotNull(); + } + + private Path gitDBRepo() throws IOException { + final Path dbDir = dirDoesNotExist(); + GitDB.initLocal(dbDir); + return dbDir; + } // Given a valid GitDb handle // When select a branch that doesn't exist then an exception is thrown