c189e8b40c2a9ed15850d5bb5a68e6789be5fc70
- Author
- Dan Wallis <mrdanwallis@gmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
feat(agnoster): add remote-tracking status to prompt (#7209)
Diff
1diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
2index 5f4efe813b4aadc49efa42d30fbbe8d8c2c43cf7..88854eccd924dfb5032c8048c542c59f31e6b829 100644
3--- a/themes/agnoster.zsh-theme
4+++ b/themes/agnoster.zsh-theme
5@@ -116,6 +116,17 @@ prompt_git() {
6 prompt_segment green $CURRENT_FG
7 fi
8
9+ local ahead behind
10+ ahead=$(git log --oneline @{upstream}.. 2>/dev/null)
11+ behind=$(git log --oneline ..@{upstream} 2>/dev/null)
12+ if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
13+ PL_BRANCH_CHAR=$'\u21c5'
14+ elif [[ -n "$ahead" ]]; then
15+ PL_BRANCH_CHAR=$'\u21b1'
16+ elif [[ -n "$behind" ]]; then
17+ PL_BRANCH_CHAR=$'\u21b0'
18+ fi
19+
20 if [[ -e "${repo_path}/BISECT_LOG" ]]; then
21 mode=" <B>"
22 elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then