jj icon indicating copy to clipboard operation
jj copied to clipboard

GIT_WORK_TREE is invalid in colocated Git repo on jj 0.28.2

Open ony opened this issue 7 months ago • 0 comments

Description

My post-rewrite Git hook started to fail when executing something like git --work-tree="$PWD" commit --amend within root of work-tree.

Issue manifests on 0.28.2. But on 0.26.0 everything works fine.

Steps to Reproduce the Problem

In some empty folder

  1. jj git init --colocate
  2. GIT_WORK_TREE="$PWD" jj show --no-pager @-

Expected Behavior

GIT_WORK_TREE="$PWD" should not affect jj as long as PWD matches repository root. E.g.

Commit ID: 0000000000000000000000000000000000000000
Change ID: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Author   : (no name set) <(no email set)> (1970-01-01 02:00:00)
Committer: (no name set) <(no email set)> (1970-01-01 02:00:00)

    (no description set)

Actual Behavior

Internal error: The repository appears broken or inaccessible
Caused by:
1: Failed to open git repository
2: Failed to load the git configuration
3: The key "core.worktree" (possibly from GIT_WORK_TREE) was invalid

Without GIT_WORK_TREE="$PWD" there is no issue.

Specifications

  • Platform: NixOS 24.11 (with jj from master)
  • Version: 0.28.2

ony avatar May 03 '25 09:05 ony