Skip to content

jj git push thinks the ref moved on remote unexpectedly, but jj git fetch does nothing #5978

@nachtjasmin

Description

@nachtjasmin

Description

It's actually hard to pinpoint the exact problem, as it hasn't occurred yet. If I had to assume it's related to the Git subprocess spawning and the fact that this was once a repository with git-lfs in use.

As a consequence, I'm not sure whether those steps are even the correct ones for reproducibility. (I have stopped touching the repository right now in order to assist with the debugging, even if I know how to workaround it.)

I'll try to create a repro and if wanted, I can compress the local Git state and send it to one of you if it helps with debugging.

Note: This was converted to a co-located Git repository once, following the guide in the documentation.

Steps to Reproduce the Problem (wild guess!)

  1. Clone a repository from git.sr.ht (edit: it is actually a bare repo on a remote host) that once used Git LFS. (TODO: build repro)
  2. Add a new change, change anything you want.
  3. Move main to the new change, push it. It should now be immutable.
  4. Create a new change again and squash it into the previous change jj squash --ignore-immutable.
  5. Move the bookmark again (should happen automatically) and try to push it.

Expected Behavior

jj should be able to push it.

Actual Behavior

jj git push -b main writes:

remote: error: denying non-fast-forward refs/heads/main (you should pull first)
Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/main
Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again.

However, and here's why this is a bug, the output of jj git fetch --all-remotes:

Nothing changed.

I can repeat this as often as I want, it'll always end up in the same state.

jj-git-fetch-debug-logs.log
jj-git-push-debug-logs.log

Specifications

  • Platform: Fedora Linux 41
  • Version: jj 0.27.0-6ce7a77da5a18343f4f3effef49b77428e43bc74, git version 2.48.1

Metadata

Metadata

Assignees

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