lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Using ref-format reftable instead of files shows as .invalid in recent repos

Open Anteus opened this issue 6 months ago • 2 comments

Describe the bug

Using reftable instead of files shows the current branch as .invalid in the recent repos menu (c-r)

To Reproduce

Steps to reproduce the behavior:

  1. Go to a repo and migrate to reftable
  2. git refs migrate --ref-format=reftable
  3. Open another repo in lazygit and then to go the repo above
  4. See error .invalid next to repo name

Expected behavior

Using reftable should show current branch in the recent repo menu.

Screenshots

If applicable, add screenshots to help explain your problem.

Version info:

commit=d167063b4f45d044524f3fba97f850d1eec3f95c, build date=2026-04-13T20:06:40Z, build source=binaryRelease, version=0.61.1, os=linux, arch=amd64, git version=2.54.0

Terminal info:

fish --version fish, version 3.7.0

Additional context

Add any other context about the problem here. Culprit below https://github.com/jesseduffield/lazygit/blob/68f3bcf53b0e19da3f7b1aaee19718605e339e8c/pkg/gui/controllers/helpers/repos_helper.go#L58

Should probably use one of

git branch --show-current
git symbolic-ref --short HEAD
git rev-parse --abbrev-ref HEAD

[!NOTE] Please try updating to the latest version or manually building the latest master to see if the issue still occurs.

Anteus avatar May 13 '26 12:05 Anteus

Confirmed on Windows with Git 2.55.0.windows.3 using a freshly initialized reftable repository.

After the first empty commit:

  • .git/HEAD still contains ref: refs/heads/.invalid
  • git branch --show-current returns master
  • git symbolic-ref --short HEAD also returns master

The current getCurrentBranch implementation reads .git/HEAD directly, so the .invalid label is deterministic for this repository format even though Git resolves the branch correctly. This reproduces the report on a second OS and suggests that querying Git, instead of interpreting HEAD on disk, is the format-independent boundary.

RRXXZZYY avatar Sep 01 '26 11:09 RRXXZZYY

Fixed in #6016.

stefanhaller avatar Sep 14 '26 11:09 stefanhaller