add git init of gopass root dir

This commit is contained in:
az 2023-06-05 22:33:48 +02:00
parent 90086e9c80
commit bf28d6306e
2 changed files with 7 additions and 1 deletions

View file

@ -83,6 +83,9 @@ fun Prov.gopassMountStore(storeName: String, path: String) = taskWithResult {
fun Prov.gopassInitStoreFolder(path: String, gpgFingerprint: String? = null ) = task { fun Prov.gopassInitStoreFolder(path: String, gpgFingerprint: String? = null ) = task {
createFile("$path/.gpg-id", gpgFingerprint ?: "_replace_this_by_a_fingerprint_of_a_public_gpg_key_") createFile("$path/.gpg-id", gpgFingerprint ?: "_replace_this_by_a_fingerprint_of_a_public_gpg_key_")
if (!checkDir(".git", path)) {
cmd("git init", path)
}
} }

View file

@ -40,9 +40,11 @@ internal class GopassKtTest {
installGopass() installGopass()
configureGopass(prov.userHome() + gopassRootDir) configureGopass(prov.userHome() + gopassRootDir)
gopassInitStoreFolder("~/exampleStoreFolder") gopassInitStoreFolder("~/exampleStoreFolder")
gopassInitStoreFolder("~/exampleStoreFolder") // check idem-potency
gopassMountStore("exampleStore", "~/exampleStoreFolder") 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 ls")
prov.cmd("gopass sync")
} }
// then // then
@ -50,6 +52,7 @@ internal class GopassKtTest {
assertTrue(res.success) assertTrue(res.success)
assertTrue(prov.fileContainsText("~/.config/gopass/config", "/home/testuser/.password-store")) assertTrue(prov.fileContainsText("~/.config/gopass/config", "/home/testuser/.password-store"))
assertTrue(prov.fileContainsText("~/.config/gopass/config", "exampleStore")) assertTrue(prov.fileContainsText("~/.config/gopass/config", "exampleStore"))
assertTrue(prov.checkDir(".git", gopassRootDir))
} }
@Test @Test