Check Repo
This commit is contained in:
parent
5c7c3cf237
commit
d13cbcb356
2 changed files with 13 additions and 1 deletions
11
checks.go
11
checks.go
|
@ -25,3 +25,14 @@ func checkRootFolder(storage string) {
|
||||||
if !seen { log.Fatal("Folder ", path, " is required but not present!") }
|
if !seen { log.Fatal("Folder ", path, " is required but not present!") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func repoExistsIn(storage string, repoId string) map[string]bool {
|
||||||
|
exists_in := map[string]bool{"fs": false, "commits": false, "blocks": false}
|
||||||
|
|
||||||
|
for storageType, _ := range exists_in {
|
||||||
|
if info, err := os.Stat(filepath.Join(storage, storageType, repoId)); err == nil && info.IsDir() {
|
||||||
|
exists_in[storageType] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return exists_in
|
||||||
|
}
|
||||||
|
|
|
@ -22,5 +22,6 @@ type Commit struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func cmdCommit(config configCollect) {
|
func cmdCommit(config configCollect) {
|
||||||
log.Println(config)
|
rexists := repoExistsIn(config.Storage, config.RepoId)
|
||||||
|
if !rexists["commits"] { log.Fatal("No commits folder found for repo ",config.RepoId) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue