summaryrefslogtreecommitdiffstats
path: root/test.sh
diff options
context:
space:
mode:
authormichaeldfallen <michaeldfallen@gmail.com>2015-02-05 23:30:32 +0000
committermichaeldfallen <michaeldfallen@gmail.com>2015-02-05 23:30:32 +0000
commitb3b64a3fbdd6545610da51a36179dae164fae2a3 (patch)
treefcc52633765b5d5aebdd37ac809391c802223adb /test.sh
downloadgit-sonar-b3b64a3fbdd6545610da51a36179dae164fae2a3.tar.gz
git-sonar-b3b64a3fbdd6545610da51a36179dae164fae2a3.zip
orchestrate async fetching
Diffstat (limited to '')
-rwxr-xr-xtest.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..bb8170d
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,38 @@
+set -e
+
+scriptDir="$( dirname "$0" )"
+
+source "$scriptDir/git-base.sh"
+
+echo "\nTest: Root of this git repo"
+echo "$(git_root)"
+
+echo "\nTest: Location of .git"
+echo "$(dot_git)"
+
+echo "\nTest: Record the timestamp"
+record_timestamp
+echo "Timestamp = $(timestamp)"
+echo "Time now = $(time_now)"
+
+echo "\nTest: Time to update when just recorded"
+if time_to_update; then
+ echo "time to update"
+else
+ echo "not time yet"
+fi
+
+echo "\nTest: Don't fetch if it's not time to update"
+fetch_async "debug"
+
+echo "\nTest: Time to update when timestamp 5 mins ago"
+touch -A "-010000" "$(dot_git)/lastupdatetime"
+if time_to_update; then
+ echo "time to update"
+else
+ echo "not time yet"
+fi
+
+echo "\nTest: Do a non-blocking git fetch"
+fetch_async "debug"
+echo "Did I block?"