Skip to content

Commit

Permalink
Better identify different config states
Browse files Browse the repository at this point in the history
  • Loading branch information
andriygm committed Dec 1, 2023
1 parent 4d4f53f commit 9475df0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cmd/status.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"dvs/internal/config"
"dvs/internal/file"
"dvs/internal/git"
"dvs/internal/log"
Expand Down Expand Up @@ -41,6 +42,12 @@ func runStatusCmd(cmd *cobra.Command, args []string) {
os.Exit(1)
}

// Get config
_, err = config.Read(gitDir)
if err != nil {
log.Print(log.IconWarning, "Devious is not initialized, run", log.ColorFaint("dvs init <storage-path>"), "to initialize\n")
}

metaPaths, err = meta.GetAllMetaFiles(gitDir)
if err != nil {
log.Print(log.IconFailure, "Failed to get meta files", log.ColorRed(err))
Expand Down
6 changes: 5 additions & 1 deletion internal/migrate/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ func migrateStorageFile(storageDir string, path string, dry bool) (match bool, e
func MigrateStorageFiles(dry bool) (files []string, err error) {
repoDir, _ := git.GetNearestRepoDir(".")
config, err := config.Read(repoDir)
if err != nil {

if os.IsNotExist(err) {
// No config file, no storage
return nil, nil
} else if err != nil {
return nil, err
}

Expand Down

0 comments on commit 9475df0

Please sign in to comment.