diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-08-29 16:52:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-29 16:52:20 +0200 |
commit | 34b101e3e2e4c7de728f9d149ef9bf1ae298a9b3 (patch) | |
tree | 79b51316a608a848f60360fd76f1ca671c471579 /status.go | |
parent | 5cc316baa64287c7e56cb7372a5046c30fd955c1 (diff) | |
parent | 75fa41d21c8d27ee0d5d7c7cb7ceeb2b765be330 (diff) | |
download | go-git-34b101e3e2e4c7de728f9d149ef9bf1ae298a9b3.tar.gz |
Merge pull request #933 from kuba--/fix-895/clean-dir
Remove empty dirs when cleaning with Dir opt.
Diffstat (limited to 'status.go')
-rw-r--r-- | status.go | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1,7 +1,10 @@ package git -import "fmt" -import "bytes" +import ( + "bytes" + "fmt" + "path/filepath" +) // Status represents the current status of a Worktree. // The key of the map is the path of the file. @@ -17,6 +20,12 @@ func (s Status) File(path string) *FileStatus { return s[path] } +// IsUntracked checks if file for given path is 'Untracked' +func (s Status) IsUntracked(path string) bool { + stat, ok := (s)[filepath.ToSlash(path)] + return ok && stat.Worktree == Untracked +} + // IsClean returns true if all the files aren't in Unmodified status. func (s Status) IsClean() bool { for _, status := range s { |