Skip to content

Commit

Permalink
Fixed assertGitStatus for filenames with spaces in linux environments
Browse files Browse the repository at this point in the history
  • Loading branch information
kriber82 authored and gregorriegler committed Sep 8, 2023
1 parent 7312daa commit 1ca20c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mob.go
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ func openLastModifiedFileIfPresent(configuration config.Configuration) {
return
}
lastModifiedFile := split[1]
if strings.Contains(lastModifiedFile, "\"") {
if strings.HasPrefix(lastModifiedFile, "\"") {
lastModifiedFile, _ = strconv.Unquote(lastModifiedFile)
}
if lastModifiedFile == "" {
Expand Down
8 changes: 6 additions & 2 deletions mob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1913,8 +1913,12 @@ func gitStatus() GitStatus {
if len(line) == 0 {
continue
}
file := strings.Fields(line)
statusMap[strings.Join(file[1:], " ")] = file[0]
fields := strings.Fields(line)
file := strings.Join(fields[1:], " ")
if strings.HasPrefix(file, "\"") {
file, _ = strconv.Unquote(file)
}
statusMap[file] = fields[0]
}
return statusMap
}
Expand Down

0 comments on commit 1ca20c9

Please sign in to comment.