19 lines
522 B
Bash
Executable file
19 lines
522 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
set -euo pipefail
|
|
export FILTER_BRANCH_SQUELCH_WARNING=1
|
|
|
|
filter_files=$(reuse spdx 2>/dev/null \
|
|
| grep -E '^(FileName: |LicenseInfoInFile: |$)' \
|
|
| rg -U -o --replace '$2 $1' "FileName: (.*)\nLicenseInfoInFile: (.*)\n" \
|
|
| sort -u \
|
|
| grep 'LicenseRef-CGV' \
|
|
| cut -d' ' -f 2 \
|
|
| tr '\n' ' ')
|
|
|
|
git branch -D filtered
|
|
git switch -c filtered
|
|
git filter-branch -f --tree-filter "rm -f ${filter_files}" HEAD
|
|
git push -f -u filtered filtered
|
|
git switch -
|