jesseduffield / jesseduffield/lazygit

Bare repo displays incorrect repo name and commit count

Open
#1,063 0 comments 2 reactions 0 assignees View on GitHub
bug
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
```
![97665616-861a5080-1a41-11eb-8bb2-730c212f816f](https://user-images.githubusercontent.com/23530447/97666532-84518c80-1a43-11eb-8fd5-42d960a2f555.png)

**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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.