jesseduffield / lazygit

simple terminal UI for git commands
MIT License
52.91k stars 1.85k forks source link

Branch panel is empty #3901

Open sankarraj-ps opened 2 months ago

sankarraj-ps commented 2 months ago

Describe the bug In some repositories, the local branch panel appears empty while all branches are visible in the CLI.

To Reproduce Steps to reproduce the behavior:

  1. Just open lazygit in particular repositories
  2. You can see the local branch panel is empty, but the commits are there.

Expected behavior Local Branches panel should contain list branches from local

Screenshots If applicable, add screenshots to help explain your problem. Screenshot 2024-09-09 at 5 44 00 PM

Version info: commit=71ad3fac63a3ef3326021837b49e9497d332818b, build date=2024-07-13T10:24:19Z, build source=binaryRelease, version=0.43.1, os=darwin, arch=amd64, git version=2.39.3 (Apple Git-146)

git version 2.39.3 (Apple Git-146)

Additional context Add any other context about the problem here.

Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

sankarraj-ps commented 2 months ago

Btw, This tool is one of the best I have ever used for my development purposes.

Kudos and Thanks to everyone involved 🥇 ❤️

stefanhaller commented 2 months ago

Is one of those repositories a public one?

sankarraj-ps commented 2 months ago

Is one of those repositories a public one?

nope, they are private

bbuff27 commented 1 month ago

I'm experiencing this same issue after updating from 0.40.0 to 0.44.0

stefanhaller commented 1 month ago

@bbuff27 Are you seeing this in a repo that you can share?

bbuff27 commented 1 month ago

Unfortunately, no I can't share the repo as it's a private business repo. Your comment did push me to check some other repos and they were working okay. Do you have any suggestions on how to troubleshoot myself?

rbrunt commented 1 month ago

I'm also seeing this, on all my private GitHub Repositories. It doesn't happen on public ones (e.g. I can clone the code for lazygit itself, and lazygit works fine in that repository).

I ran lazygit --debug and can see that I get an error when this bug happens, that doesn't appear on the public repositories:

Sep 13 10:38:29 |ERRO| 20:7: empty subsection name

And here's a full set of logs from launch, up to the error appearing (paths redacted):

Sep 13 10:43:22 |INFO| starting main loop
Sep 13 10:43:22 |INFO| Updating is currently not supported for windows until we can fix permission issues
Sep 13 10:43:22 |INFO| refreshing all scopes in async mode
Sep 13 10:43:22 |INFO| Refresh took 0s
Sep 13 10:43:22 |DEBU| RunCommand command="cmd /c title <redacted:repo name> - Lazygit"
Sep 13 10:43:22 |DEBU| RunCommand command="git fetch --all --no-write-fetch-head"
Sep 13 10:43:22 |DEBU| RunCommand command="git stash list -z --pretty=%ct|%gs"
Sep 13 10:43:22 |DEBU| RunCommand command="git rev-parse --abbrev-ref --verify HEAD"
Sep 13 10:43:22 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Sep 13 10:43:22 |DEBU| RunCommand command="git tag --list -n --sort=-creatordate"
Sep 13 10:43:22 |DEBU| RunCommand command="git merge-base HEAD refs/remotes/origin/main"
Sep 13 10:43:22 |INFO| git merge-base HEAD refs/remotes/origin/main (69.0255ms)
Sep 13 10:43:22 |DEBU| using cache for key rebase.updateRefs
Sep 13 10:43:22 |INFO| postRefreshUpdate for commits took 1.0602ms
Sep 13 10:43:22 |DEBU| using cache for key rebase.updateRefs
Sep 13 10:43:22 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Sep 13 10:43:22 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (70.9617ms)
Sep 13 10:43:22 |ERRO| 20:7: empty subsection name
stefanhaller commented 1 month ago

@rbrunt Thanks for investigating.

It looks like there's a syntax error in your repo's local .git/config file (at line 20), my guess is that it contains something like [remote ""] or [branch ""] there.

I can reproduce the problem on my end if I add such an entry to mine. I'll have a look if there's anything we can do on our side to handle this more gracefully.

rbrunt commented 1 month ago

@stefanhaller great spot: I can confirm that there is. Looking at my problematic repos, it's because there's an entry like the following:

[snyk ""]
    baseBranch = 

Removing this from .git/config fixes the issue in lazygit.

I suspect this is being added by the synk VSCode plugin, but need to confirm that....

If there's a way to handle this more gracefully in lazygit, that would be great (other clients don't seem to be affected), but I'll see if I can raise this with Synk too...

bbuff27 commented 1 month ago

@stefanhaller To confirm, after finding the same in my .git/config as @rbrunt, I also resolved the problem by removing those lines.