Description
Current behavior 😯
# /tmp
; git init repo
Initialized empty Git repository in /private/tmp/repo/.git/
# /tmp
; cd repo
# /tmp/repo
; git commit --allow-empty -m 'empty'
[master (root-commit) ca4f799] empty
# /tmp/repo
; git config core.bare true
# /tmp/repo
; git status
fatal: this operation must be run in a work tree
# /tmp/repo
; gix status
23:58:05 status done 0.0 files in 0.00s (0.0 files/s)
head -> index isn't implemented yet
And
fn main() {
let repo = gix::open("/tmp/repo").unwrap();
dbg!(repo.work_dir());
}
should print None, but it's Some("/tmp/repo")
.
Expected behavior 🤔
Gix status should not succeed. Also, Repository::work_dir()
should be None.
Git behavior
Refuses to do worktree-related things if core.bare=true. But please note that core.bare=true is generally not respected when opening the repo from a worktree: https://git-scm.com/docs/git-worktree#_configuration_file
By default, the repository config file is shared across all worktrees. If the config variables core.bare or core.worktree are present in the common config file and extensions.worktreeConfig is disabled, then they will be applied to the main worktree only.
In order to have worktree-specific configuration, you can turn on the worktreeConfig extension, [...]
I couldn't care less about the worktreeConfig extension, seems pretty niche. But "applied to the main worktree only" is the important part.
Steps to reproduce 🕹
See above