diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Gopass.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Gopass.kt index 0dcdfcb..84ab597 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Gopass.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/Gopass.kt @@ -83,6 +83,9 @@ fun Prov.gopassMountStore(storeName: String, path: String) = taskWithResult { fun Prov.gopassInitStoreFolder(path: String, gpgFingerprint: String? = null ) = task { createFile("$path/.gpg-id", gpgFingerprint ?: "_replace_this_by_a_fingerprint_of_a_public_gpg_key_") + if (!checkDir(".git", path)) { + cmd("git init", path) + } } diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/GopassKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/GopassKtTest.kt index aa34e22..f192823 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/GopassKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/GopassKtTest.kt @@ -40,9 +40,11 @@ internal class GopassKtTest { installGopass() configureGopass(prov.userHome() + gopassRootDir) gopassInitStoreFolder("~/exampleStoreFolder") + gopassInitStoreFolder("~/exampleStoreFolder") // check idem-potency gopassMountStore("exampleStore", "~/exampleStoreFolder") - gopassMountStore("exampleStore", "~/exampleStoreFolder") // check that mounting twice gives no error + gopassMountStore("exampleStore", "~/exampleStoreFolder") // check idem-potency prov.cmd("gopass ls") + prov.cmd("gopass sync") } // then @@ -50,6 +52,7 @@ internal class GopassKtTest { assertTrue(res.success) assertTrue(prov.fileContainsText("~/.config/gopass/config", "/home/testuser/.password-store")) assertTrue(prov.fileContainsText("~/.config/gopass/config", "exampleStore")) + assertTrue(prov.checkDir(".git", gopassRootDir)) } @Test