diff options
author | EuAndreh <eu@euandre.org> | 2023-06-25 08:32:50 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-06-25 08:32:53 -0300 |
commit | bdb0d5b39fb988755410d2a84baedfb512fb5744 (patch) | |
tree | d0b793611043adfb82b3f842d058d0b065acbef6 /opt | |
parent | etc/sh/rc: Add commented vi mappings (diff) | |
download | dotfiles-bdb0d5b39fb988755410d2a84baedfb512fb5744.tar.gz dotfiles-bdb0d5b39fb988755410d2a84baedfb512fb5744.tar.xz |
opt/tests/uninclude.sh: Do not dirty the repository
To avoid race conditions with the "check-dirty-public" target.
Diffstat (limited to 'opt')
-rw-r--r-- | opt/resources/can-remove-stdbool.copy.expected (renamed from opt/resources/can-remove-stdbool.c.expected) | 0 | ||||
-rw-r--r-- | opt/resources/nothing-can-be-removed.copy.expected (renamed from opt/resources/nothing-can-be-removed.c.expected) | 0 | ||||
-rwxr-xr-x | opt/tests/uninclude.sh | 11 |
3 files changed, 5 insertions, 6 deletions
diff --git a/opt/resources/can-remove-stdbool.c.expected b/opt/resources/can-remove-stdbool.copy.expected index f3da0d3..f3da0d3 100644 --- a/opt/resources/can-remove-stdbool.c.expected +++ b/opt/resources/can-remove-stdbool.copy.expected diff --git a/opt/resources/nothing-can-be-removed.c.expected b/opt/resources/nothing-can-be-removed.copy.expected index 773852f..773852f 100644 --- a/opt/resources/nothing-can-be-removed.c.expected +++ b/opt/resources/nothing-can-be-removed.copy.expected diff --git a/opt/tests/uninclude.sh b/opt/tests/uninclude.sh index bb11f05..0a5d41e 100755 --- a/opt/tests/uninclude.sh +++ b/opt/tests/uninclude.sh @@ -1,12 +1,13 @@ #!/bin/sh +set -eu -git restore opt/resources/ +find opt/resources/ -name '*.c' | sed 's/^\(.*\)\.c$/cp \1.c \1.copy/g' | sh # shellcheck disable=2086 -find opt/resources/ -name '*.c' | - sh ~/.usr/bin/uninclude -E '^#include ' -- cc $CFLAGS +find opt/resources/ -name '*.copy' | + uninclude -E '^#include ' -- $CC $CFLAGS -c -find opt/resources/ -name '*.c' | while read -r file; do +find opt/resources/ -name '*.copy' | while read -r file; do if ! cmp -s "$file" "$file".expected; then cat <<-EOF The unincluded file is different from expected. @@ -15,8 +16,6 @@ find opt/resources/ -name '*.c' | while read -r file; do $ diff -U5 $file.expected $file EOF exit 1 - else - git restore "$file" fi done |