summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgit-base.sh11
-rwxr-xr-xtest-directories.sh1
2 files changed, 4 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() {
diff --git a/test-directories.sh b/test-directories.sh
index 1520ffb..e9b6d07 100755
--- a/test-directories.sh
+++ b/test-directories.sh
@@ -77,6 +77,7 @@ test_time_to_update_when_no_timestamp() {
cd_to_tmp
git init --quiet
+ time_to_update
assertTrue time_to_update
rm_tmp