(changes merkletrie.Changes)
| 145 | } |
| 146 | |
| 147 | func (w *Worktree) excludeIgnoredChanges(changes merkletrie.Changes) merkletrie.Changes { |
| 148 | patterns, err := gitignore.ReadPatterns(w.Filesystem, nil) |
| 149 | if err != nil { |
| 150 | return changes |
| 151 | } |
| 152 | |
| 153 | patterns = append(patterns, w.Excludes...) |
| 154 | |
| 155 | if len(patterns) == 0 { |
| 156 | return changes |
| 157 | } |
| 158 | |
| 159 | m := gitignore.NewMatcher(patterns) |
| 160 | |
| 161 | var res merkletrie.Changes |
| 162 | for _, ch := range changes { |
| 163 | var path []string |
| 164 | for _, n := range ch.To { |
| 165 | path = append(path, n.Name()) |
| 166 | } |
| 167 | if len(path) == 0 { |
| 168 | for _, n := range ch.From { |
| 169 | path = append(path, n.Name()) |
| 170 | } |
| 171 | } |
| 172 | if len(path) != 0 { |
| 173 | isDir := (len(ch.To) > 0 && ch.To.IsDir()) || (len(ch.From) > 0 && ch.From.IsDir()) |
| 174 | if m.Match(path, isDir) { |
| 175 | if len(ch.From) == 0 { |
| 176 | continue |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | res = append(res, ch) |
| 181 | } |
| 182 | return res |
| 183 | } |
| 184 | |
| 185 | func (w *Worktree) getSubmodulesStatus() (map[string]plumbing.Hash, error) { |
| 186 | o := map[string]plumbing.Hash{} |
no test coverage detected