Non-`main` default branches
It's super confusing to call my default branch main when it's not main in wt list (elsewhere?).
Please consider using the correct name of the branch.
In wt list, the only place I found main fixed in place of the real default-branch name is the two column headers main↕ and main…±. They're string constants in ColumnKind::header. The values in those columns already compare each branch against your actual default branch, whatever it's called. --format=json reports the real name as repo.default_branch.
The fixed label is deliberate for now. #3998 kept main in every repository, and the list docs say so ("The main↕ and main…± headers keep the familiar main label in every repository"). The commit's reasoning was to avoid passing the default-branch name through the layout code. Showing the real name would also change the layout: both column widths are sized from their headers (fit_header in layout.rs), so a name like development would widen both columns and could push other columns off narrow terminals. Long names would need to be cut short or replaced with a fallback label. Whether this report outweighs those costs is a maintainer decision, so I haven't opened a PR to change it.
It's factually incorrect to call it main though, and if you're looking for a static value, default would be more accurate. But personally I'd rather have the dynamic column header I think.
Both options are cheaper than my last comment made them sound. The headers are display text only: [list] columns selects these columns by the keys ahead-behind and branch-diff, so renaming the headers doesn't break any config.
I overstated the width cost before. Each header only sets its column's width when the header is wider than the values beneath it. In layout.rs, the ahead/behind column is sized for 7-character values (↑99 ↓99) and the branch-diff column for 9-character values (+999 -999). So:
- A dynamic header costs no width for names up to 6 characters (
master↕,trunk…±). A name likedevelopadds one column, and much longer names would need a cap or a fallback label. - A static
defaultgivesdefault↕(8 characters, one wider than today) anddefault…±(9 characters, no change).
What's left is whether to reverse #3998's choice to keep the familiar main label, and that's @max-sixty's call. If they prefer one of these options, I can make the change, including the help text, generated docs and snapshots.
Similarly, and just because it's related to the same column width issue... the +∞ when a worktree's diff count exceeds the column size is confusing and wrong. Again, personally I'd rather prioritize these stats to get the full width needed, than see the message, or path columns in full...
∞ stands for "10,000 or more", not an unknown or infinite count. format_overflow handles any value too wide for its column: line counts from 1,000 to 9,999 show as 1K–9K, commit counts from 100 to 999 show as 1C–9C (hundreds), and anything from 10,000 up shows as ∞. Approximate values are drawn one emphasis level brighter so they stand apart from exact ones. The exact counts are always in wt list --format=json (added/deleted under each diff).
The list docs don't explain any of this. So your reaction is reasonable: nothing tells you +∞ means "at least 10K lines". At minimum that needs a doc fix.
Showing the full number has the same shape of cost as the header question. The diff and ahead/behind columns get fixed widths before any data arrives. That's what lets wt list draw the table at once and fill cells in as git finishes, and it's why a large value gets abbreviated instead of widening the column. Making these columns grow to fit their data means either waiting for every diff before drawing, or redrawing once a wider value turns up. Giving these stats priority over message/path when the terminal is narrow is a separate change to how columns are dropped. Like the header label, how to weigh these is @max-sixty's call. If they want one, I can make the doc fix on its own or together with a rendering change.
I also really don't like 3C instead of 3xx it saves one character and was something I had to dig up to understand.
3xx takes as much room as the exact count. Commit counts get two digit places per side (layout.rs), so ↑3C fits and ↑3xx doesn't. Giving each side a third place would also fit ↑348. So if the column grows, the better change is to show exact counts up to 999, the way the line-diff columns already do (they have three places, and format_overflow shows +648 there with no abbreviation). The cost is two characters on each commit-count column: ahead/behind and upstream both go from 7 to 9 wide (↑999 ↓999). Above 999, counts would still abbreviate to K.
That's the same width trade-off as your other two points, so I'll leave it with them for @max-sixty. Whatever they decide, the docs should explain C, K and ∞.
we could use the first x chars; we could use ^ which is the symbol we've adopted for the default branch?
(agree with main not being great)
Branch Status HEAD± ^↕ ^± Remote⇅ Path
~~I don't hate this, but I think I'd rather personally just see the branch name. I'm a bit less interested in abbreviating things that this project perhaps.~~ You know, the more I stare at it, the more I kinda like it.
It helps to look at it in context with the first status line:
Branch Status HEAD± ^↕ ^± Remote⇅
@ master ^| |
(I'm also still trying to turn my OCD about the ↕ vs ⇅ sizing off)
So this might be more changing things around than you want, but FYI @ is HEAD in Git, so we could also make it consistent by changing HEAD± to @± as well...
That would mean that the "current worktree" symbol would probably want to change though.
Otherwise, I think I'm still in the, "just show the branch name" camp.
So this might be more changing things around than you want, but FYI @ is HEAD in Git
yes if we do ^ we should do the @...
I opened #4732 with both changes. The column headers are now @±, ^↕ and ^…±, replacing HEAD±, main↕ and main…±. No column gets wider, because each width is still set by its values (+999 -999, ↑99 ↓99). The list docs now say that ^ means the default branch and @ means the worktree's HEAD, the same as in wt switch. I kept the … in ^…± because it marks the three-dot (merge-base) diff.
The PR doesn't change how the C/K/∞ overflow values are shown, so those points are still open here.
Would it be worth another issue for this?
I also really don't like 3C instead of 3xx it saves one character and was something I had to dig up to understand.
Yes, the header part of this issue is done (#4732), so I opened #4769 for the shortened counts. It covers C vs 3xx, ∞, giving those columns priority on narrow terminals, and the missing docs.
Closing this, since the default-branch label it reports is fixed on main. #4732 renamed the wt list headers to ^↕ and ^…±, so they no longer say main when the default branch has another name. It also renamed HEAD± to @±. The points about shortened counts (C, K, ∞) and column priority on narrow terminals are still open in #4769.