jesseduffield / jesseduffield/lazygit
Bare repo displays incorrect repo name and commit count
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
**Describe the bug**
In #1023 support for bare repositories was added. However when using a bare repo the Status does not display correctly.
1. Instead of the repo name (as defined by `--git-dir`) being displayed the name of the `--work-tree` directory is used instead (my `$HOME` directory in this case).
2. The count of how many commits ahead or behind of origin displays as `↑?↓?` instead of the actual counts.
**To Reproduce**
Steps to reproduce the behavior:
1. Create bare repo and remote
2. Point `lazygit` to bare repo and work tree:
```shell
lazygit --git-dir=$XDG_DATA_HOME/dotfiles --work-tree=$HOME
```

**Expected behavior**
Status should use the name of `--git-dir` for repo name and correctly display the commit count.
**Desktop:**
- OS: Linux
- Lazygit Version: v0.23.6.7c1889cd
- The last commit id if you built project from sources: 7c1889cd
**Additional context**
Add any other context about the problem here.
I am trying to use `lazygit` for managing my dotfiles, similarly to [this](https://www.atlassian.com/git/tutorials/dotfiles) and #778.
---
**Related question:** Is there anyway to use `lazygit` to browse/edit tracked files in addition to changed/staged files? I think this functionality would make `lazygit` the perfect tool for managing dotfiles the bare repo way as you would be able to browse and edit only the files you care about directly from `lazygit`. Such as with [`git-ls-files(1)`](https://git-scm.com/docs/git-ls-files) or [`git-ls-tree(1)`](https://git-scm.com/docs/git-ls-tree): [Stack Overflow source](https://stackoverflow.com/a/32827149)
```shell
git ls-tree --full-tree -r --name-only HEAD
```
Contributor guide
Assessment
This issue has not been assessed yet.