From 7b0dcd6c9d7a600b4eab690c5c78e67aa8d4769f Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Thu, 12 Feb 2026 12:10:16 +0100 Subject: [PATCH] added force option --- collect-repos.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/collect-repos.sh b/collect-repos.sh index 6a35330..2bf9973 100644 --- a/collect-repos.sh +++ b/collect-repos.sh @@ -5,6 +5,11 @@ set -euo pipefail +FORCE=false +if [ "${1:-}" = "--force" ] || [ "${1:-}" = "-f" ]; then + FORCE=true +fi + SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" OUTPUT_DIR="${SCRIPT_DIR}/collected" TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S') @@ -77,6 +82,7 @@ echo "=== Repo Collector ===" echo "Timestamp: $TIMESTAMP" echo "Working dir: $SCRIPT_DIR" echo "Output dir: $OUTPUT_DIR" +[ "$FORCE" = true ] && echo "Mode: FORCE (rebuilding all)" echo "" # --- Pull all repos first --- @@ -113,7 +119,7 @@ for repo_dir in */; do output_file="${OUTPUT_DIR}/${repo_dir}.txt" # Check if repo changed since last collection - if [ -f "$output_file" ]; then + if [ "$FORCE" = false ] && [ -f "$output_file" ]; then output_mtime=$(stat -c %Y "$output_file" 2>/dev/null || echo 0) # Get latest commit timestamp in the repo repo_last_commit=$(git -C "$repo_dir" log -1 --format=%ct 2>/dev/null || echo 0)