diff options
| author | Michael Allen <michael@michaelallen.io> | 2015-02-23 16:31:38 +0000 | 
|---|---|---|
| committer | Michael Allen <michael@michaelallen.io> | 2015-02-23 16:34:49 +0000 | 
| commit | 0e5f04c68674f5f775b0973fa8b2bde4ff1eab4f (patch) | |
| tree | 0397af8250b36bcae593aa16f613dd4f9519a0b3 /git-base.sh | |
| parent | 85867b8e5be3bed7b79e7711a3d1bed2327f1188 (diff) | |
| download | git-sonar-0e5f04c68674f5f775b0973fa8b2bde4ff1eab4f.tar.gz git-sonar-0e5f04c68674f5f775b0973fa8b2bde4ff1eab4f.zip | |
fixed bad math and added recording the timestamp when we fetch
Diffstat (limited to '')
| -rwxr-xr-x | git-base.sh | 11 | 
1 files changed, 3 insertions, 8 deletions
| 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() { | 
