Add filtering script

This commit is contained in:
Simon Bruder 2023-05-09 23:11:02 +02:00
parent 25e159d96b
commit a1f8720e74

9
filter.sh Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
set -euo pipefail
export FILTER_BRANCH_SQUELCH_WARNING=1
git branch -D filtered
git switch -c filtered
git filter-branch -f --tree-filter "rm -f $(rg --files-without-match 'SPDX-License-Identifier: (L)?GPL-3.0-or-later' -g '/u??/**/*' | tr '\n' ' ')" HEAD
git push -f -u filtered filtered
git switch -