Skip to content

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

@Yi2255

Description

@Yi2255

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:
    mkdir -p /i4/repo0 /i4/repo1
  2. Initialize and cross-link git directories:
    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:
    cd /i4/repo0
    git status
    Expected CLI output:
    fatal: this operation must be run in a work tree
    
  4. Run gitui in the same path:
    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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions