We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 98c481b commit ebe96bcCopy full SHA for ebe96bc
scripts/loadup-setup.sh
@@ -50,14 +50,27 @@ then
50
fi
51
52
53
-HAS_GIT= [ -f $(which git) ] && [ -x $(which git) ]
+HAS_GIT= [ -f $(command -v git) ] && [ -x $(command -v git) ]
54
export HAS_GIT
55
56
+is_git_dir () {
57
+ if ${HAS_GIT}
58
+ then
59
+ return $(cd "$1"; git status >/dev/null 2>/dev/null; echo $?)
60
+ else
61
+ return 1
62
+ fi
63
+}
64
+
65
66
git_commit_ID () {
- if ${HAS_GIT};
67
68
then
- # This does NOT indicate if there are any modified files!
- COMMIT_ID=$(git -C "$1" rev-parse --short HEAD)
69
+ if is_git_dir "$1"
70
71
+ # This does NOT indicate if there are any modified files!
72
+ COMMIT_ID=$(git -C "$1" rev-parse --short HEAD)
73
74
75
}
76
0 commit comments