summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-10-16 17:13:27 +0100
committerMichael Allen <michael@michaelallen.io>2015-10-16 17:13:27 +0100
commiteb0e287cb322ef7cebd77941d51910180aefb185 (patch)
treef35fe7546a8549170da98e5a25d2cb6de8eb5a7e
parenta72cc5136a8e9f25d9b3c60922e2f390bbdfae01 (diff)
parent104d96c9ff839ab1bf5789a06df887b546d60dfe (diff)
downloadgit-sonar-eb0e287cb322ef7cebd77941d51910180aefb185.tar.gz
git-sonar-eb0e287cb322ef7cebd77941d51910180aefb185.zip
Merge pull request #79 from hallzy/issue69
Issue69
-rwxr-xr-xradar-base.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/radar-base.sh b/radar-base.sh
index c355f3c..0dea4b5 100755
--- a/radar-base.sh
+++ b/radar-base.sh
@@ -1,6 +1,7 @@
NO_REMOTE_STATUS='--no-remote-status'
dot_git=""
+stat_type=""
cwd=""
remote=""
rcfile_path="$HOME"
@@ -126,6 +127,15 @@ dot_git() {
fi
}
+stat_type() {
+ if [[ "$OSTYPE" == "darwin"* ]]; then
+ stat_type="gstat"
+ else
+ stat_type="stat"
+ fi
+ printf '%s' $stat_type
+}
+
is_repo() {
if [[ -n "$(dot_git)" ]]; then
return 0
@@ -150,7 +160,7 @@ record_timestamp() {
timestamp() {
if is_repo; then
- printf '%s' "$(stat -f%m "$(dot_git)/lastupdatetime" 2>/dev/null || printf '%s' "0")"
+ printf '%s' "$($(stat_type) -c%Y "$(dot_git)/lastupdatetime" 2>/dev/null || printf '%s' "0")"
fi
}