summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2021-03-24 02:03:32 -0400
committerMalfurious <m@lfurio.us>2021-03-24 02:03:32 -0400
commitfee615fe9fd3a535bd6dfd8fcf01c3dee9300b6c (patch)
tree98a7f4b58e199a7b3adbf5d663d0d9453dd6fcb8
parent4c8973e82367a370988b7ae41be00fb51dd1ea9f (diff)
parent9af949b6bd2969dc82a12ef3f143f2b2d446f03b (diff)
downloadgit-sonar-fee615fe9fd3a535bd6dfd8fcf01c3dee9300b6c.tar.gz
git-sonar-fee615fe9fd3a535bd6dfd8fcf01c3dee9300b6c.zip
Merge branch 'feature/git-directory-patch' of https://github.com/rholmboe/git-radar
Merge pending pull request #107 of upstream git-radar project from user rholmboe. Note I did manually resolve a fairly trivial conflict in the is_cwd_a_dot_git_directory() function. From the original PR: Bug #98 wasn't really propagated correctly, you still got git-fetch bug when you entered a sub-directory in .git. Now it's recursive, faster and still POSIX compliant.
-rwxr-xr-xradar-base.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/radar-base.sh b/radar-base.sh
index 9d52012..649978f 100755
--- a/radar-base.sh
+++ b/radar-base.sh
@@ -555,11 +555,17 @@ stashed_status() {
}
is_cwd_a_dot_git_directory() {
- [[ "$(basename "$PWD")" == ".git" ]]; return $?
+ if [[ "${1##*/}" == ".git" ]]; then
+ return 0
+ elif [[ -z $1 ]]; then
+ return 1
+ else
+ is_cwd_a_dot_git_directory "${1%/*}"
+ fi
}
stash_status() {
- if ! is_cwd_a_dot_git_directory; then
+ if ! is_cwd_a_dot_git_directory "$PWD"; then
local number_stashes="$(stashed_status)"
if [ $number_stashes -gt 0 ]; then
printf $PRINT_F_OPTION "${number_stashes}${COLOR_STASH}≡${RESET_COLOR_STASH}"