aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-01 15:11:07 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-01 15:11:07 +1200
commita0703ceedc8eb1d42a5afa1836c554ae9d5638a6 (patch)
tree73793061264e9bd3d654f6d9eba6a5c5b9a45b5f
parentAdd isgr(1) (diff)
downloaddotfiles-a0703ceedc8eb1d42a5afa1836c554ae9d5638a6.tar.gz
dotfiles-a0703ceedc8eb1d42a5afa1836c554ae9d5638a6.zip
Have td(1) use isgr(1)
Needs to test for its existence first, otherwise it'll create a repository for no reason
-rwxr-xr-xbin/td10
1 files changed, 2 insertions, 8 deletions
diff --git a/bin/td b/bin/td
index 466d2ed4..bd399698 100755
--- a/bin/td
+++ b/bin/td
@@ -27,15 +27,9 @@ fi
# Change into the directory
cd -- "$dir" || exit
-# Quick function to determine if a directory is a Git repository
-isrepo() {
- { git symbolic-ref --quiet HEAD ||
- git rev-parse --short HEAD
- } >/dev/null 2>&1
-}
-
# If the current directory isn't a Git repository, try to create one
-if ! isrepo ; then
+hash isgr || exit
+if ! isgr ; then
git init || exit
fi