diff options
author | Fabian Sabau <fabian.sabau+git@gmail.com> | 2019-02-21 16:32:45 +0100 |
---|---|---|
committer | Fabian Sabau <fabian.sabau+git@gmail.com> | 2019-03-04 11:50:35 +0100 |
commit | bf0d56e7f2ce9b6538fb8a75fbdc2bcea1bc2995 (patch) | |
tree | ac4a6486b46e4571c2270e2d751b61e37ffcae6a /worktree_status.go | |
parent | af1e3817a80cccb560b25b0fd3343894754020ba (diff) | |
download | go-git-bf0d56e7f2ce9b6538fb8a75fbdc2bcea1bc2995.tar.gz |
worktree: enable manual ignore patterns when no .gitignore is available
Signed-off-by: Fabian Sabau <fabian.sabau+git@gmail.com>
Diffstat (limited to 'worktree_status.go')
-rw-r--r-- | worktree_status.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/worktree_status.go b/worktree_status.go index 0e113d0..16ce937 100644 --- a/worktree_status.go +++ b/worktree_status.go @@ -142,12 +142,16 @@ func (w *Worktree) diffStagingWithWorktree(reverse bool) (merkletrie.Changes, er func (w *Worktree) excludeIgnoredChanges(changes merkletrie.Changes) merkletrie.Changes { patterns, err := gitignore.ReadPatterns(w.Filesystem, nil) - if err != nil || len(patterns) == 0 { + if err != nil { return changes } patterns = append(patterns, w.Excludes...) + if len(patterns) == 0 { + return changes + } + m := gitignore.NewMatcher(patterns) var res merkletrie.Changes |