diff options
-rwxr-xr-x | rsup | 6 | ||||
-rwxr-xr-x | sup | 4 |
2 files changed, 7 insertions, 3 deletions
@@ -57,7 +57,11 @@ function upward_commit { } # Check if it is a git repository -if [ ! -d ".git" ]; then +# Thanks https://stackoverflow.com/questions/4917871/does-git-return-specific-return-error-codes#comment124785102_19441790 +#git status &> /dev/null +#if [ ! -d ".git" ]; then +#if [ "$?" == "128" ]; then +if [ "`git rev-parse --is-inside-work-tree &> /dev/null`" == "true" ]; then echo "$BASENAME: not a git repository" exit 1 fi @@ -39,9 +39,9 @@ GIT="hit" # done #} -# Check if it is a git repository +# Check if it is a git repository, and wheter we're in the top of it if [ ! -d ".git" ]; then - echo "$BASENAME: not a git repository" + echo "$BASENAME: not a git repository, or not in the top-level of that repository" exit 1 fi |