diff options
-rwxr-xr-x | radar-base.sh | 3 | ||||
-rwxr-xr-x | test-directories.sh | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/radar-base.sh b/radar-base.sh index 0f4a35a..099debd 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -183,9 +183,10 @@ time_now() { } time_to_update() { + last_time_updated="${1:-$FETCH_TIME}" if is_repo; then local timesincelastupdate="$(($(time_now) - $(timestamp)))" - if (( $timesincelastupdate > $1 )); then + if (( $timesincelastupdate > $last_time_updated )); then # time to update return 0 (which is true) return 0 else diff --git a/test-directories.sh b/test-directories.sh index 86a441e..5dde303 100755 --- a/test-directories.sh +++ b/test-directories.sh @@ -63,12 +63,14 @@ test_record_timestamp_in_repo() { test_time_to_update_when_timestamp_is_old() { cd $scriptDir + FETCH_TIME="$((5 * 60))" # Fetch every 5 mins touch -A "-010000" "$(dot_git)/lastupdatetime" assertTrue time_to_update } test_not_time_to_update_when_just_recorded() { cd $scriptDir + FETCH_TIME="$((5 * 60))" # Fetch every 5 mins record_timestamp assertFalse time_to_update } @@ -77,6 +79,7 @@ test_time_to_update_when_no_timestamp() { cd_to_tmp git init --quiet + FETCH_TIME="$((5 * 60))" # Fetch every 5 mins time_to_update assertTrue time_to_update |