fork of go-git with some jj specific features

Add Status.IsUntracked function

Signed-off-by: kuba-- <kuba@sourced.tech>

kuba-- 75fa41d2 0167dabb

Changed files
+12 -5
+11 -2
status.go
··· 1 1 package git 2 2 3 - import "fmt" 4 - import "bytes" 3 + import ( 4 + "bytes" 5 + "fmt" 6 + "path/filepath" 7 + ) 5 8 6 9 // Status represents the current status of a Worktree. 7 10 // The key of the map is the path of the file. ··· 15 18 } 16 19 17 20 return s[path] 21 + } 22 + 23 + // IsUntracked checks if file for given path is 'Untracked' 24 + func (s Status) IsUntracked(path string) bool { 25 + stat, ok := (s)[filepath.ToSlash(path)] 26 + return ok && stat.Worktree == Untracked 18 27 } 19 28 20 29 // IsClean returns true if all the files aren't in Unmodified status.
+1 -3
worktree.go
··· 750 750 return err 751 751 } 752 752 } else { 753 - // check if file is 'Untracked' 754 - s, ok := (status)[filepath.ToSlash(path)] 755 - if ok && s.Worktree == Untracked { 753 + if status.IsUntracked(path) { 756 754 if err := w.Filesystem.Remove(path); err != nil { 757 755 return err 758 756 }