Skip to content

Commit

Permalink
Add check to see if the current directory is a git repo
Browse files Browse the repository at this point in the history
  • Loading branch information
agsdot committed Jan 22, 2017
1 parent 2a5982b commit 4cbe353
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions git-redate
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#!/bin/bash

is_git_repo() {
git rev-parse --show-toplevel > /dev/null 2>&1
result=$?
if test $result != 0; then
>&2 echo 'Not a git repo!'
exit $result
fi
}

is_git_repo

while [[ $# -gt 1 ]]
do
key="$1"
Expand Down

0 comments on commit 4cbe353

Please sign in to comment.