diff options
| author | EuAndreh <eu@euandre.org> | 2026-06-26 18:21:07 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2026-06-26 18:21:07 -0300 |
| commit | 70403862d434683730cd59796c7e91c97977809f (patch) | |
| tree | 4c7b403466f419292297ce81cc987a6cda5e0de7 | |
| parent | etc/guix/home.scm: addremove packages (diff) | |
| download | dotfiles-70403862d434683730cd59796c7e91c97977809f.tar.gz dotfiles-70403862d434683730cd59796c7e91c97977809f.tar.xz | |
bin/vcs: Add origin detection for git_ps1()
Diffstat (limited to '')
| -rwxr-xr-x | bin/vcs | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -88,6 +88,16 @@ git_ps1() { IS_BEHIND=true fi + HAS_UPSTREAM=false + if printf '%s\n' "$BRANCH_LINE" | grep -qF '...'; then + HAS_UPSTREAM=true + fi + + HAS_ORIGIN=false + if [ -n "$(git config --local --get remote.origin.url 2>/dev/null)" ]; then + HAS_ORIGIN=true + fi + LINE='' if [ "$IS_AHEAD" = true ] && [ "$IS_BEHIND" = true ]; then @@ -118,6 +128,13 @@ git_ps1() { elif [ "$HAS_UNTRACKED" = true ]; then COLOR_FN=lightblue LINE="{$LINE}" + elif [ "$HAS_UPSTREAM" = false ]; then + if [ "$HAS_ORIGIN" = true ]; then + COLOR_FN=yellow + else + COLOR_FN=yellowb + fi + LINE="($LINE)" else COLOR_FN=green LINE="($LINE)" |
