summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rwxr-xr-xradar-base.sh20
2 files changed, 19 insertions, 8 deletions
diff --git a/README.md b/README.md
index 7e84317..91f87cd 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,7 @@ last few years. Maybe it can help you too.
- [Colouring the remote commits status](#colouring-the-remote-commits-status)
- [Colouring the file changes status](#colouring-the-file-changes-status)
- [License](#license)
+- [Links](#links)
## Installation
@@ -78,7 +79,7 @@ Add to your `config.fish`
function fish_prompt
set_color $fish_color_cwd
echo -n (prompt_pwd)
- git-radar --fish --fetch
+ echo -n (git-radar --fish --fetch)
set_color normal
echo -n ' > '
end
@@ -557,6 +558,10 @@ Git Radar is licensed under the MIT license.
See [LICENSE] for the full license text.
+## Links
+
+* [mini-git-radar](https://github.com/bogem/mini-git-radar) - lightweight version of git-radar. Only for macOS and bash/fish.
+
[LICENSE]: https://github.com/michaeldfallen/git-radar/blob/master/LICENSE
[git:(master) 1≡]: https://raw.githubusercontent.com/michaeldfallen/git-radar/master/images/stash.png
[git:(master) 3A]: https://raw.githubusercontent.com/michaeldfallen/git-radar/master/images/untracked.png
diff --git a/radar-base.sh b/radar-base.sh
index 42ec333..79f7c8e 100755
--- a/radar-base.sh
+++ b/radar-base.sh
@@ -63,7 +63,7 @@ prepare_bash_colors() {
RESET_COLOR_CHANGES="\x01${GIT_RADAR_COLOR_CHANGES_RESET:-"\\033[0m"}\x02"
RESET_COLOR_BRANCH="\x01${GIT_RADAR_COLOR_BRANCH_RESET:-"\\033[0m"}\x02"
RESET_COLOR_STASH="\x01${GIT_RADAR_COLOR_STASH:-"\\033[0m"}\x02"
-
+
}
prepare_zsh_colors() {
@@ -90,7 +90,7 @@ prepare_zsh_colors() {
COLOR_CHANGES_UNTRACKED="%{${GIT_RADAR_COLOR_CHANGES_UNTRACKED:-$fg_bold[white]}%}"
COLOR_STASH="%{${GIT_RADAR_COLOR_STASH:-$fg_bold[yellow]}%}"
-
+
local italic_m="$(printf '\xF0\x9D\x98\xAE')"
COLOR_BRANCH="%{${GIT_RADAR_COLOR_BRANCH:-$reset_color}%}"
@@ -249,7 +249,7 @@ remote_branch_name() {
commits_behind_of_remote() {
remote_branch=${1:-"$(remote_branch_name)"}
if [[ -n "$remote_branch" ]]; then
- git rev-list --left-only --count ${remote_branch}...HEAD
+ git rev-list --left-only --count ${remote_branch}...HEAD 2>/dev/null
else
printf '%s' "0"
fi
@@ -258,7 +258,7 @@ commits_behind_of_remote() {
commits_ahead_of_remote() {
remote_branch=${1:-"$(remote_branch_name)"}
if [[ -n "$remote_branch" ]]; then
- git rev-list --right-only --count ${remote_branch}...HEAD
+ git rev-list --right-only --count ${remote_branch}...HEAD 2>/dev/null
else
printf '%s' "0"
fi
@@ -536,10 +536,16 @@ stashed_status() {
printf '%s' "$(git stash list | wc -l 2>/dev/null | grep -oEi '[0-9][0-9]*')"
}
+is_cwd_a_dot_git_directory() {
+ [[ "$(basename "$PWD")" == ".git" ]]; return $?
+}
+
stash_status() {
- local number_stashes="$(stashed_status)"
- if [ $number_stashes -gt 0 ]; then
- printf $PRINT_F_OPTION "$number_stashes$COLOR_STASH≡$RESET_COLOR_STASH"
+ if ! is_cwd_a_dot_git_directory; then
+ local number_stashes="$(stashed_status)"
+ if [ $number_stashes -gt 0 ]; then
+ printf $PRINT_F_OPTION "${number_stashes}${COLOR_STASH}≡${RESET_COLOR_STASH}"
+ fi
fi
}