From dc7374408271715840b1d3bfda3deabf783a563c Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Tue, 19 May 2015 16:05:57 -0700 Subject: [PATCH] fsrepo: Detect uninitialized repo by missing config file Earlier, it also checked checked the leveldb directory. That part added no crash safety to the application, and just hardcoded assumptions about the datastore. If anything, this should rely on the absolute last item created by fsrepo.Init, and there should be fsync guarantees about ordering. License: MIT Signed-off-by: Tommi Virtanen --- repo/fsrepo/fsrepo.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/repo/fsrepo/fsrepo.go b/repo/fsrepo/fsrepo.go index 097b684c8..98dc1bc59 100644 --- a/repo/fsrepo/fsrepo.go +++ b/repo/fsrepo/fsrepo.go @@ -622,8 +622,10 @@ func isInitializedUnsynced(repoPath string) bool { if !configIsInitialized(repoPath) { return false } + if !util.FileExists(filepath.Join(repoPath, leveldbDirectory)) { return false } + return true }