diff --git a/src/main/java/net/kemitix/gitdb/impl/GitDBTransactionImpl.java b/src/main/java/net/kemitix/gitdb/impl/GitDBTransactionImpl.java index 28687d9..262a8ef 100644 --- a/src/main/java/net/kemitix/gitdb/impl/GitDBTransactionImpl.java +++ b/src/main/java/net/kemitix/gitdb/impl/GitDBTransactionImpl.java @@ -54,8 +54,8 @@ class GitDBTransactionImpl implements GitDBTransaction { } @Override - public GitDBBranch remove(String key) { - return null; + public GitDBBranch remove(String key) throws IOException { + return branch.remove(key); } @Override diff --git a/src/test/java/net/kemitix/gitdb/test/GitDBTest.java b/src/test/java/net/kemitix/gitdb/test/GitDBTest.java index 2738670..92b4339 100644 --- a/src/test/java/net/kemitix/gitdb/test/GitDBTest.java +++ b/src/test/java/net/kemitix/gitdb/test/GitDBTest.java @@ -408,6 +408,20 @@ class GitDBTest implements WithAssertions { assertThat(originalBranch.get(key)).contains(value); } + // When removing a key in a transaction then the transaction branch no longer finds it + @Test + void removeKey_whenTransaction_thenTransactionNotFind() throws IOException { + //given + final String key = stringSupplier.get(); + final String value = stringSupplier.get(); + final GitDBBranch originalBranch = gitDBBranchWithKeyValue(key, value); + final GitDBTransaction transaction = originalBranch.transaction(); + //when + final GitDBBranch removed = transaction.remove(key); + //then + assertThat(removed.get(key)).isEmpty(); + } + // Given a GitDbTransaction handle with a added, updated and removed keys // When closing the transaction an GitDbBranch is returned // When closing the transaction the added key/value is found