Skip to content

fix: open repos when ~/.gitconfig has conflict markers - #188

Merged
hewigovens merged 1 commit into
mainfrom
cursor/gitconfig-conflict-open-3cb6
Aug 31, 2026
Merged

fix: open repos when ~/.gitconfig has conflict markers#188
hewigovens merged 1 commit into
mainfrom
cursor/gitconfig-conflict-open-3cb6

Conversation

@hewigovens

@hewigovens hewigovens commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

jj-lib opens the colocated Git repo with gix strict_config(true) and the default (non-isolated) config sources. If ~/.gitconfig is a symlink into a repo (the hewigovens/dotfiles install.sh pattern: ~/.gitconfig~/dotfiles/.gitconfig) and that file has conflict markers, jj itself refuses to load the repo:

Internal error: The repository appears broken or inaccessible
Caused by:
1: Failed to open git repository
2: Failed to load the git configuration
3: Got an unexpected token on line 3 ... '<<<<<<< Co'

JayJay then showed “Failed to open repository” until the conflict was resolved by hand — which is the chicken-and-egg: you need the repo open to resolve .gitconfig.

Workspace::load only displays Cannot read the repo; the gix parse error is on the source chain. Matching that Display string is how the first revision missed the retry.

Change

When a path contains .jj and Workspace::load fails, retry with GIT_CONFIG_GLOBAL pointed at an empty file. That lets JayJay open the repo so the conflicted .gitconfig can be resolved in the UI.

If the retry also fails, the error keeps the full cause chain and adds a hint about conflict markers / a symlinked ~/.gitconfig. A .jj directory that fails to load is reported as an internal error instead of “repository not found.”

This is a workaround, not an upstream jj fix. The CLI still fails in the same situation.

Test plan

  • Regression: Repo::open + refresh_working_copy succeed when GIT_CONFIG_GLOBAL contains jj conflict markers (child process so parallel fixtures are not poisoned)
  • cargo test -p jayjay-core --test repo
  • cargo test -p jayjay-core --lib --test working_copy --test conflicts --test workspace_presence

@hewigovens
hewigovens marked this pull request as ready for review August 31, 2026 02:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T03:04:14.274917Z 6cf4b77 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor
cursor Bot force-pushed the cursor/gitconfig-conflict-open-3cb6 branch from 6cf4b77 to 4c0dba5 Compare August 31, 2026 02:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6cf4b771f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/jayjay-core/src/repo/support.rs Outdated
Comment thread crates/jayjay-core/src/repo/support.rs Outdated
@cursor
cursor Bot force-pushed the cursor/gitconfig-conflict-open-3cb6 branch 4 times, most recently from a617b99 to f2e7c3a Compare August 31, 2026 05:10
jj-lib's WorkspaceLoadError Display is only "Cannot read the repo",
so a conflicted ~/.gitconfig looked like a missing repository. Join
the source chain at load so the gix token error is what the user sees.
@cursor
cursor Bot force-pushed the cursor/gitconfig-conflict-open-3cb6 branch from f2e7c3a to faf409b Compare August 31, 2026 06:11
@hewigovens
hewigovens merged commit 4b5a47c into main Aug 31, 2026
5 checks passed
@hewigovens
hewigovens deleted the cursor/gitconfig-conflict-open-3cb6 branch August 31, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant