Add file exclusion via josh stored filters (v1.2.0)

New `exclude` config field per target generates .josh-filters/<name>.josh
files with josh :exclude clauses. Josh-proxy applies exclusions at the
transport layer — excluded files never appear in the subrepo.

Preflight checks that generated filter files are committed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 22:45:13 +03:00
parent 401d0e87a4
commit 187a9ead14
5 changed files with 138 additions and 2 deletions

View File

@@ -422,6 +422,28 @@ cmd_preflight() {
warn ".gitea/workflows/josh-sync-reverse.yml not found (optional)"
fi
# 4. Exclude filter files
local has_excludes
has_excludes=$(echo "$JOSH_SYNC_TARGETS" | jq '[.[] | select((.exclude // []) | length > 0)] | length')
if [ "$has_excludes" -gt 0 ]; then
echo ""
echo "4. Exclude filter files"
while IFS= read -r target_name; do
local filter_file=".josh-filters/${target_name}.josh"
if [ -f "$filter_file" ]; then
if git ls-files --error-unmatch "$filter_file" >/dev/null 2>&1; then
pass "${filter_file} exists and is tracked"
else
warn "${filter_file} exists but is NOT committed — run: git add ${filter_file}"
fi
else
fail "${filter_file} not generated — check parse_config"
fi
done < <(echo "$JOSH_SYNC_TARGETS" | jq -r '.[] | select((.exclude // []) | length > 0) | .name')
fi
# Summary
echo ""
echo "============================="