diff options
author | Michael Allen <michael@michaelallen.io> | 2015-02-23 16:20:31 +0000 |
---|---|---|
committer | Michael Allen <michael@michaelallen.io> | 2015-02-23 16:20:31 +0000 |
commit | 85867b8e5be3bed7b79e7711a3d1bed2327f1188 (patch) | |
tree | ae291af8307992794f3d29358321691edad2a9b6 /git-base.sh | |
parent | e91f893e79091369f89e0a38a523735744de5cce (diff) | |
download | git-sonar-85867b8e5be3bed7b79e7711a3d1bed2327f1188.tar.gz git-sonar-85867b8e5be3bed7b79e7711a3d1bed2327f1188.zip |
default timestamp to 0 if no recorded timestamp
Diffstat (limited to 'git-base.sh')
-rwxr-xr-x | git-base.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/git-base.sh b/git-base.sh index f147979..41e8833 100755 --- a/git-base.sh +++ b/git-base.sh @@ -13,6 +13,10 @@ in_current_dir() { fi } +echodebug() { + echo "$@" 1>&2 +} + debug_print() { local debug=$1 local message=$2 @@ -58,7 +62,7 @@ record_timestamp() { timestamp() { if is_repo; then - echo "$(stat -f%m "$(dot_git)/lastupdatetime")" + echo "$(stat -f%m "$(dot_git)/lastupdatetime" || echo 0)" fi } @@ -70,7 +74,7 @@ time_to_update() { if is_repo; then local timesincelastupdate="$(($(time_now) - $(timestamp)))" local fiveminutes="$((5 * 60))" - if (( "$timesincelastupdate" > "$5minutes" )); then + if (( "$timesincelastupdate" > "$fiveminutes" )); then # time to update return 0 (which is true) return 0 else |