gitui-org / gitui-org/gitui

GitUI shows working-tree changes in cross-linked bare repos where Git reports no work tree

Open
#2,867 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
22.5k
Forks
773
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
In a mutual bare-repo reference setup, `gitui` shows working-tree file changes while Git CLI reports there is no work tree.

Example mismatch:
- `git status` in `/i4/repo0` returns: `fatal: this operation must be run in a work tree`
- `gitui` in `/i4/repo0` still shows many unstaged entries (`HEAD`, `config`, `hooks/`, etc.)

This is misleading because the repo is not in a valid work-tree state for normal file status operations.

**To Reproduce**
Steps to reproduce the behavior:
1. Create two repos at fixed reproducible paths:
```bash
mkdir -p /i4/repo0 /i4/repo1
```
2. Initialize and cross-link git directories:
```bash
cd /i4/repo0
git init --bare
git init --separate-git-dir=../repo1

cd /i4/repo1
git init --bare
git init --separate-git-dir=../repo0
```
3. Verify CLI behavior in `/i4/repo0`:
```bash
cd /i4/repo0
git status
```
Expected CLI output:
```text
fatal: this operation must be run in a work tree
```
4. Run `gitui` in the same path:
```bash
cd /i4/repo0
gitui
```
5. Observe that `gitui` still lists unstaged/untracked files.When Git reports no work tree, `gitui` should not show normal working-tree file changes. It should present an error/state consistent with Git CLI.

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.