(changes merkletrie.Changes)
| 162 | } |
| 163 | |
| 164 | func (w *Worktree) excludeIgnoredChanges(changes merkletrie.Changes) merkletrie.Changes { |
| 165 | patterns, err := gitignore.ReadPatterns(w.Filesystem, nil) |
| 166 | if err != nil { |
| 167 | return changes |
| 168 | } |
| 169 | |
| 170 | patterns = append(patterns, w.Excludes...) |
| 171 | |
| 172 | if len(patterns) == 0 { |
| 173 | return changes |
| 174 | } |
| 175 | |
| 176 | m := gitignore.NewMatcher(patterns) |
| 177 | |
| 178 | var res merkletrie.Changes |
| 179 | for _, ch := range changes { |
| 180 | var path []string |
| 181 | for _, n := range ch.To { |
| 182 | path = append(path, n.Name()) |
| 183 | } |
| 184 | if len(path) == 0 { |
| 185 | for _, n := range ch.From { |
| 186 | path = append(path, n.Name()) |
| 187 | } |
| 188 | } |
| 189 | if len(path) != 0 { |
| 190 | isDir := (len(ch.To) > 0 && ch.To.IsDir()) || (len(ch.From) > 0 && ch.From.IsDir()) |
| 191 | if m.Match(path, isDir) { |
| 192 | if len(ch.From) == 0 { |
| 193 | continue |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | res = append(res, ch) |
| 198 | } |
| 199 | return res |
| 200 | } |
| 201 | |
| 202 | func (w *Worktree) getSubmodulesStatus() (map[string]plumbing.Hash, error) { |
| 203 | o := map[string]plumbing.Hash{} |
no test coverage detected