diff options
-rwxr-xr-x | git-base.sh | 2 | ||||
-rwxr-xr-x | test-files.sh | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/git-base.sh b/git-base.sh index fbd7ef9..b08c820 100755 --- a/git-base.sh +++ b/git-base.sh @@ -227,7 +227,7 @@ is_dirty() { else #no commit hash, thus can't use HEAD. #As it's inital commit we can just list the files. - if [[ -n "$(ls -a -1 | grep -Ev '(\.|\.\.|\.git)')" ]]; then + if [[ -n "$(ls -a -1 "$(git_root)" | grep -Ev '(\.|\.\.|\.git)')" ]]; then #files listed and no commit hash, thus changes return 0 else diff --git a/test-files.sh b/test-files.sh index 270ee3b..4c5e9c4 100755 --- a/test-files.sh +++ b/test-files.sh @@ -248,6 +248,12 @@ test_is_dirty() { touch foo assertTrue "untracked files" is_dirty + mkdir sneakSubDir + cd sneakSubDir + assertTrue "untracked files while in an empty sub dir" is_dirty + + cd ../ + git add . assertTrue "staged addition files" is_dirty |