Files
Charon/scripts/history-rewrite/tmp_run_clean_history_test.sh
GitHub Actions 3169b05156 fix: skip incomplete system log viewer tests
- Marked 12 tests as skip pending feature implementation
- Features tracked in GitHub issue #686 (system log viewer feature completion)
- Tests cover sorting by timestamp/level/method/URI/status, pagination controls, filtering by text/level, download functionality
- Unblocks Phase 2 at 91.7% pass rate to proceed to Phase 3 security enforcement validation
- TODO comments in code reference GitHub #686 for feature completion tracking
- Tests skipped: Pagination (3), Search/Filter (2), Download (2), Sorting (1), Log Display (4)
2026-02-09 21:55:55 +00:00

49 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
TMPREMOTE=$(mktemp -d)
git init --bare "$TMPREMOTE/remote.git"
TMPCLONE=$(mktemp -d)
cd "$TMPCLONE"
git clone "$TMPREMOTE/remote.git" .
# create a commit
mkdir -p backend/codeql-db
echo 'dummy' > backend/codeql-db/foo.txt
git add -A
git commit -m "Add dummy file" -q
git checkout -b feature/test
# set up stub git-filter-repo in PATH
## Resolve the repo root based on the script file location (Bash-safe)
# Use ${BASH_SOURCE[0]} instead of $0 to correctly resolve the script path even
# when invoked from different PWDs or via sourced contexts.
REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../" && pwd -P)
TMPBIN=$(mktemp -d)
cat > "$TMPBIN/git-filter-repo" <<'SH'
#!/usr/bin/env sh
# Minimal stub to simulate git-filter-repo
while [ $# -gt 0 ]; do
shift
done
exit 0
SH
chmod +x "$TMPBIN/git-filter-repo"
export PATH="$TMPBIN:$PATH"
# run clean_history.sh with dry-run
# NOTE: Avoid hard-coded repo paths like /projects/Charon/
# Use the dynamically-derived REPO_ROOT (above) or a relative path from this script
# so this helper script runs correctly on other machines/CI environments.
# Examples:
# "$REPO_ROOT/scripts/history-rewrite/clean_history.sh" --dry-run ...
# "$(dirname "$0")/clean_history.sh" --dry-run ...
"$REPO_ROOT/scripts/history-rewrite/clean_history.sh" --dry-run --paths 'backend/codeql-db' --strip-size 1
# run clean_history.sh with force should attempt to push branch then succeed (requires that remote exists)
"$REPO_ROOT/scripts/history-rewrite/clean_history.sh" --force --paths 'backend/codeql-db' --strip-size 1 <<'IN'
I UNDERSTAND
IN
# test non-interactive with force
"$REPO_ROOT/scripts/history-rewrite/clean_history.sh" --force --non-interactive --paths 'backend/codeql-db' --strip-size 1
# cleanup
rm -rf "$TMPREMOTE" "$TMPCLONE" "$TMPBIN"
echo 'done'