Skip to content

acidhub Prompt Shows All Git Branches After Fish 4.0.0 Upgrade #11179

Description

@aholland

Description

After upgrading to Fish 4.0.0, the acidhub prompt (set via fish_config prompt choose acidhub) displays a long, concatenated list of all Git branches in my repo instead of just the current branch. This worked correctly in Fish 3.7.1, showing only the current branch (e.g., (git:main)). Now it's unusable due to length and clutter.

Steps to Reproduce

  1. Install Fish 4.0.0 (e.g., via Homebrew: brew install fish).
  2. Set prompt: fish_config prompt choose acidhub (add to ~/.config/fish/config.fish).
  3. Enter a Git repo with multiple branches (e.g., git init; git branch feature1; git branch feature2).
  4. Check prompt in an interactive session.

Expected Behavior

Prompt shows only the current branch, e.g.:
(user-/path/to/repo(git:main)) >

Actual Behavior

Prompt shows all branches concatenated, e.g.:
(anthonyholland-/IdeaProjects/cyb/dev/gal-web-sk-area/gal-web-v2(git:chore/ncu-fix feature1 feature2 ... sentry/1-failed-import/vite-preloadError)) >

Environment

  • Fish Version: 4.0.0 (confirmed with fish --version)
  • OS: macOS (assumed from Homebrew; specify your version, e.g., 14.3)
  • Terminal: [e.g., Terminal.app, iTerm2—please specify]
  • Git Version: [run git --version, e.g., 2.39.2]

Additional Info

  • git rev-parse --abbrev-ref HEAD correctly outputs the current branch (e.g., sentry/1-failed-import/vite-preloadError).
  • Standalone fish_git_prompt works fine: (sentry/1-failed-import/vite-preloadError).
  • Overriding fish_git_prompt doesn’t fix the full acidhub prompt, suggesting acidhub bypasses it or uses a broken Git query post-4.0.0 rewrite (Rewrite it in Rust #9512).
  • Repo has many branches (30+), which might amplify the issue.

Workaround

Using a custom fish_prompt with git rev-parse --abbrev-ref HEAD resolves it, but loses acidhub’s styling:

function fish_prompt
    set -l branch (git rev-parse --abbrev-ref HEAD 2>/dev/null)
    echo -n "❰$USER❙"(prompt_pwd)"($branch)❱✔≻ "
end

Suspected Cause

Likely a regression from the C++-to-Rust rewrite (#9512) affecting how acidhub parses Git data, possibly via a changed default in __fish_git_prompt_* vars or direct Git calls.

Thanks for looking into this!

PS Full workaround

# Colored prompt with optional git: prefix
function fish_prompt
    set -l last_status $status
    # Use $PWD for full path, replace $HOME with ~ for brevity
    set -l pwd (string replace -r "^$HOME" '~' $PWD)
    set -l branch (git rev-parse --abbrev-ref HEAD 2>/dev/null)

    # Username in cyan
    echo -n (set_color cyan)"❰$USER"
    # Separator in white
    echo -n (set_color white)"❙"
    # Path in yellow
    echo -n (set_color yellow)"$pwd"
    # Git branch in green, with or without "git:" prefix
    if test -n "$branch"
        echo -n (set_color green)"("
        # Uncomment the next line if you want "git:" back
        # echo -n "git:"
        echo -n "$branch)"
    end
    # Status symbol: green ✔ for success, red ✘ for failure
    if test $last_status -eq 0
        echo -n (set_color green)"❱✔≻ "
    else
        echo -n (set_color red)"❱✘≻ "
    end
    # Reset color
    set_color normal
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionSomething that used to work, but was broken, especially between releases

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions