File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,25 +6,43 @@ trap 'rm -f "$manifest"' EXIT
66
77cargo package --allow-dirty --list > " $manifest "
88
9+ if command -v rg > /dev/null 2>&1 ; then
10+ search_exact () {
11+ rg -Fxq " $1 " " $manifest "
12+ }
13+
14+ search_prefix () {
15+ rg -q " ^$1 " " $manifest "
16+ }
17+ else
18+ search_exact () {
19+ grep -Fxq " $1 " " $manifest "
20+ }
21+
22+ search_prefix () {
23+ grep -Eq " ^$1 " " $manifest "
24+ }
25+ fi
26+
927require () {
1028 local path=" $1 "
11- if ! rg -Fxq " $path " " $manifest " ; then
29+ if ! search_exact " $path " ; then
1230 echo " missing packaged file: $path " >&2
1331 exit 1
1432 fi
1533}
1634
1735reject_prefix () {
1836 local prefix=" $1 "
19- if rg -q " ^ ${ prefix} " " $manifest " ; then
37+ if search_prefix " $ prefix" ; then
2038 echo " unexpected packaged path matching prefix: $prefix " >&2
2139 exit 1
2240 fi
2341}
2442
2543reject_exact () {
2644 local path=" $1 "
27- if rg -Fxq " $path " " $manifest " ; then
45+ if search_exact " $path " ; then
2846 echo " unexpected packaged file: $path " >&2
2947 exit 1
3048 fi
You can’t perform that action at this time.
0 commit comments