|
74 | 74 | [patterns file-path] |
75 | 75 | (boolean (some #(re-find (re-pattern %) file-path) patterns))) |
76 | 76 |
|
77 | | -(defn- has-meaningful-changes? |
78 | | - "Returns true if the package has changed files that don't all match ignore |
79 | | - patterns. Files are matched against patterns using paths relative to the |
80 | | - package root." |
81 | | - [project-root pkg ref ignore-changes] |
82 | | - (let [files (git.files/find-changed-files-since |
83 | | - project-root {:ref ref |
| 77 | +(defn- commit-has-meaningful-changes? |
| 78 | + "Returns true if the commit has changed files that don't all match ignore |
| 79 | + patterns. Files are matched relative to the package root." |
| 80 | + [project-root pkg ignore-changes commit] |
| 81 | + (let [files (git.files/find-commit-changed-files |
| 82 | + project-root {:sha (:sha commit) |
84 | 83 | :subdir (:relative-path pkg)}) |
85 | 84 | pkg-prefix (str (:relative-path pkg) "/") |
86 | 85 | relative-files (map #(str/replace-first % pkg-prefix "") files)] |
|
98 | 97 | :subdir (:relative-path pkg)}) |
99 | 98 | pkg-ignore-changes (or (:ignore-changes pkg) ignore-changes) |
100 | 99 | commits (if (and (seq pkg-ignore-changes) (seq commits) ref) |
101 | | - (if (has-meaningful-changes? project-root pkg ref pkg-ignore-changes) |
102 | | - commits |
103 | | - []) |
| 100 | + (filterv #(commit-has-meaningful-changes? |
| 101 | + project-root pkg pkg-ignore-changes %) |
| 102 | + commits) |
104 | 103 | commits) |
105 | 104 | pkg (assoc pkg :commits (vec commits))] |
106 | 105 | [pkg-name pkg])) |
|
118 | 117 | Any commits found will be appended to the packages `:commits` key. |
119 | 118 |
|
120 | 119 | An optional `opts` map may be provided with `:ignore-changes` - a sequence of |
121 | | - regexp patterns. When all changed files in a package match these patterns, |
122 | | - the package is treated as unchanged." |
| 120 | + regexp patterns. Commits where all changed files match these patterns are |
| 121 | + filtered out." |
123 | 122 | {:malli/schema [:-> :string core.schema/?PackageMap core.schema/?PackageMap]} |
124 | 123 | ([project-root packages] |
125 | 124 | (resolve-package-changes project-root nil packages)) |
|
138 | 137 | Any commits found will be appended to the packages `:commits` key. |
139 | 138 |
|
140 | 139 | An optional `opts` map may be provided with `:ignore-changes` - a sequence of |
141 | | - regexp patterns. When all changed files in a package match these patterns, |
142 | | - the package is treated as unchanged." |
| 140 | + regexp patterns. Commits where all changed files match these patterns are |
| 141 | + filtered out." |
143 | 142 | {:malli/schema [:-> :string :string core.schema/?PackageMap core.schema/?PackageMap]} |
144 | 143 | ([project-root rev packages] |
145 | 144 | (resolve-package-changes-since project-root rev nil packages)) |
|
0 commit comments