summaryrefslogtreecommitdiffstats
path: root/test.sh
diff options
context:
space:
mode:
authormichaeldfallen <michaeldfallen@gmail.com>2015-02-06 00:18:27 +0000
committermichaeldfallen <michaeldfallen@gmail.com>2015-02-06 00:18:27 +0000
commitdb4d3a9c42b788561bfd15d32a841cd1e8fd5a5f (patch)
treefa8091c028c5d1a582f85358fe63ab52700cb03d /test.sh
parentb3b64a3fbdd6545610da51a36179dae164fae2a3 (diff)
downloadgit-sonar-db4d3a9c42b788561bfd15d32a841cd1e8fd5a5f.tar.gz
git-sonar-db4d3a9c42b788561bfd15d32a841cd1e8fd5a5f.zip
don't let functions complain if we aren't in a git repo
Diffstat (limited to '')
-rwxr-xr-xtest.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/test.sh b/test.sh
index bb8170d..cc65c64 100755
--- a/test.sh
+++ b/test.sh
@@ -4,12 +4,23 @@ scriptDir="$( dirname "$0" )"
source "$scriptDir/git-base.sh"
+echo "\n---------------------------"
+echo "\n In a git repo"
+echo "\n---------------------------"
+
echo "\nTest: Root of this git repo"
echo "$(git_root)"
echo "\nTest: Location of .git"
echo "$(dot_git)"
+echo "\nTest: is_repo should be false"
+if is_repo; then
+ echo "is repo"
+else
+ echo "not repo"
+fi
+
echo "\nTest: Record the timestamp"
record_timestamp
echo "Timestamp = $(timestamp)"
@@ -36,3 +47,41 @@ fi
echo "\nTest: Do a non-blocking git fetch"
fetch_async "debug"
echo "Did I block?"
+
+
+echo "\n---------------------------"
+echo "\n Not in a git repo"
+echo "\n---------------------------"
+
+mkdir -p /tmp/git-base-tests
+cd /tmp/git-base-tests
+
+echo "\nTest: Root of this git repo"
+echo "git_root is:$(git_root) (empty means no root)"
+
+echo "\nTest: Location of .git"
+echo "dot_git is:$(dot_git) (empty means no root)"
+
+echo "\nTest: is_repo should be false"
+if is_repo; then
+ echo "is repo"
+else
+ echo "not repo"
+fi
+
+echo "\nTest: Record the timestamp"
+record_timestamp
+echo "no output should be seen"
+
+echo "\nTest: Check the timestamp"
+echo "timestamp is:$(timestamp) (empty means not in dir)"
+
+echo "\nTest: Is it time to update?"
+if time_to_update; then
+ echo "time to update"
+else
+ echo "not time yet"
+fi
+
+echo "\nTest: Try to fetch"
+fetch_async "debug"