Skip to content

Conversation

@tim-harding
Copy link

@tim-harding tim-harding commented Dec 22, 2025

Motivation and Context

Showing the Git branch name in the prompt is redundant to the working directory when using Git worktrees to manage feature branches.

Closes #617

Screenshots

1766447839_grim

How Has This Been Tested

  • I have tested using Linux.
  • I have tested using MacOS.

Checklist

  • I am ready to update the wiki accordingly.
1766447718_grim
  • I have updated the tests accordingly.

@tim-harding tim-harding force-pushed the tharding/no-branch-name/main branch 10 times, most recently from ff3548b to dbfb250 Compare December 22, 2025 22:40
Include new configuration variable in all of the presets.
@tim-harding tim-harding force-pushed the tharding/no-branch-name/main branch from b7e769a to c722049 Compare December 22, 2025 23:42
Timothy Harding added 3 commits December 22, 2025 15:42
> If a named capture group matched an empty string,
> the variable will be set to the empty string (like `set var ""`).
> If it did not match,
> the variable will be set to nothing          (like `set var`).

https://fishshell.com/docs/current/cmds/string-match.html

Use + instead of * to only create variables for non-empty strings.
Otherwise,

```
(set_color black)$my_var
```

still emits a value when my_var is the empty string. This prepares the
following commit. If we don't do this, then we end up with a bunch of
extra spacing because git signs that are not present still create list
items.
The previous version assumes that the location will be there, so the
leading space before each sign works. However, this assumption breaks
when the location is omitted, resulting in extra leading space. To fix
this, create each item without padding and concatenate them with spaces.
Delete the location variable if the branch is configured to be hidden.
@tim-harding tim-harding force-pushed the tharding/no-branch-name/main branch from c722049 to dd5e388 Compare December 22, 2025 23:42
@tim-harding tim-harding force-pushed the tharding/no-branch-name/main branch from dd5e388 to 1b95868 Compare December 22, 2025 23:48
@tim-harding tim-harding marked this pull request as ready for review December 22, 2025 23:59
@tim-harding
Copy link
Author

I've done my best to give you a structured history with reasoning behind each change. Let me know if you have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to hide the Git branch

1 participant