From 0e5f04c68674f5f775b0973fa8b2bde4ff1eab4f Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Mon, 23 Feb 2015 16:31:38 +0000 Subject: fixed bad math and added recording the timestamp when we fetch --- git-base.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'git-base.sh') diff --git a/git-base.sh b/git-base.sh index 41e8833..7024161 100755 --- a/git-base.sh +++ b/git-base.sh @@ -62,7 +62,7 @@ record_timestamp() { timestamp() { if is_repo; then - echo "$(stat -f%m "$(dot_git)/lastupdatetime" || echo 0)" + echo "$(stat -f%m "$(dot_git)/lastupdatetime" || echo "0")" fi } @@ -74,7 +74,7 @@ time_to_update() { if is_repo; then local timesincelastupdate="$(($(time_now) - $(timestamp)))" local fiveminutes="$((5 * 60))" - if (( "$timesincelastupdate" > "$fiveminutes" )); then + if (( $timesincelastupdate > $fiveminutes )); then # time to update return 0 (which is true) return 0 else @@ -87,19 +87,14 @@ time_to_update() { } fetch_async() { - local debug="$1" if time_to_update; then - debug_print $debug "Starting fetch" + record_timestamp fetch $debug & - else - debug_print $debug "Didn't fetch" fi } fetch() { - local debug="$1" git fetch - debug_print $debug "Finished fetch" } commit_short_sha() { -- cgit v1.2.3