added force option
This commit is contained in:
+7
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user