diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-09-10 11:33:35 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2018-09-10 11:33:35 +0200 |
commit | bf0593d86ef73f28d3eb097c02d53a6a036f52f7 (patch) | |
tree | 2cfe20ab4b2ee85280aeabba40fd004d88e8b47f /status.go | |
parent | f8adfff71d844df7efa1367b7958e8f26411aaf9 (diff) | |
parent | a2d62f58ea626bb9f41de6431f6f18ca92cf78a0 (diff) | |
download | go-git-bf0593d86ef73f28d3eb097c02d53a6a036f52f7.tar.gz |
Merge branch 'master' of github.com:src-d/go-git into f-add-tagging-support
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 { |