Skip to content

"this operation must be run in a work tree" when working directory is a bare repo #4

Open
@skkeeper

Description

@skkeeper

Replication steps:

  • create a new directory with a bare git repo ("git init --bare")
  • cd into it

The prompt will show
fatal: this operation must be run in a work tree

I think the git status --porcelain is the culprit but I haven't managed to redirect the stderr properly or test if that's even a correct fix.

This is pretty annoying for people that work with bare repositories as a root for "git worktree" commands.

This also affects forks like "MAHcodes/distro-prompt"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions