Commits

Paul Ruane  committed 142b0a5

Improved handling in 'status' command of paths that are not a child of the working directory.

  • Participants
  • Parent commits 6ad0d60

Comments (0)

Files changed (1)

File src/main/commands/status.go

     "path/filepath"
     "fmt"
     "os"
+    "strings"
 )
 
 type StatusCommand struct {}
         if error != nil { return nil, nil, nil, error }
 
         for _, entry := range databaseEntries {
-            fmt.Printf("Searching FS entries for '%v'\n", entry)
             if contains(fileSystemEntries, entry) {
                 tagged = append(tagged, entry)
             } else {
     workingDirectory, error := os.Getwd()
     if error != nil { return "", error }
 
-    relPath, error := filepath.Rel(workingDirectory, path)
-    if error != nil { return path, nil }
+    workingDirectory += string(filepath.Separator)
 
-    return relPath, nil
+    if strings.HasPrefix(path, workingDirectory) {
+        return path[len(workingDirectory):], nil
+    }
+
+    return path, nil
 }