File tree 3 files changed +23
-16
lines changed
3 files changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,11 @@ def fetch-package [
207
207
throw-error $' No package matching version `($version )`'
208
208
}
209
209
210
+ if $pkg.dirty {
211
+ throw-error ($' Content of package file `($pkg.path )'
212
+ + $' ` does not match expected hash.' )
213
+ }
214
+
210
215
print $pkg
211
216
212
217
if $pkg.type == ' git' {
Original file line number Diff line number Diff line change @@ -13,15 +13,19 @@ export def main [
13
13
search-package $package -- registry $registry -- exact-match=$exact_match
14
14
| flatten
15
15
| each {|row |
16
- {
17
- registry_name : $row.registry_name
18
- registry_path : $row.registry_path
19
- name : $row.pkgs.name
20
- version : $row.pkgs.version
21
- path : $row.pkgs.path
22
- type : $row.pkgs.type
23
- info : $row.pkgs.info
16
+ if $row.pkgs.dirty {
17
+ null
18
+ } else {
19
+ {
20
+ registry_name : $row.registry_name
21
+ registry_path : $row.registry_path
22
+ name : $row.pkgs.name
23
+ version : $row.pkgs.version
24
+ path : $row.pkgs.path
25
+ type : $row.pkgs.type
26
+ info : $row.pkgs.info
27
+ }
24
28
}
25
29
}
26
- | filter-by-version $pkg_version
30
+ | compact | filter-by-version $pkg_version
27
31
}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use misc.nu [check-cols url hash-file]
8
8
export const REG_COLS = [ name path hash ]
9
9
10
10
# Columns of a registry package file
11
- export const REG_PKG_COLS = [ name version path type info ]
11
+ export const REG_PKG_COLS = [ name version path type info dirty ]
12
12
13
13
# Search for a package in a registry
14
14
export def search-package [
@@ -86,19 +86,17 @@ export def search-package [
86
86
87
87
let new_hash = $pkg_file_path | hash-file
88
88
89
- if $new_hash != $row.hash {
90
- throw-error ($' Content of package file ($pkg_file_path )'
91
- + $' does not match expected hash ($row.hash )' )
92
- }
89
+ # check package hash
90
+ let dirty = $new_hash != $row.hash
93
91
94
- open $pkg_file_path
92
+ open $pkg_file_path | insert dirty $dirty
95
93
}
96
94
| flatten
97
95
98
96
{
99
97
registry_name : $name
100
98
registry_path : $registry.path
101
- pkgs : $pkgs
99
+ pkgs : $pkgs ,
102
100
}
103
101
}
104
102
| compact
You can’t perform that action at this time.
0 commit comments