jj icon indicating copy to clipboard operation
jj copied to clipboard

Include nonconflicted files in root tree of file-conflict Git commits

Open amiryal opened this issue 8 months ago • 12 comments

With the aim of better compatibility with tools that look for the state of working-copy files in the colocated Git’s HEAD, I propose to include all the would-be working copy files in the commit, in addition to the .jj-conflict-* trees that are already there for preventing GC.

This came up in a discussion about Nix flakes, and the way it breaks when HEAD@git has file conflicts. It was pointed out that:

Nix flakes actually use file contents from the working copy, but the index to determine which files to include.

Originally posted by @emilazy in https://github.com/martinvonz/jj/discussions/3970#discussioncomment-9878676

In other parts of the discussion, there has been reluctance towards updating Git’s index with the would-be working tree of HEAD@git (that is the parent of the jj working copy). When I suggested to instead change the way file-conflict commits are prepared in Git, it was pointed out that the barrier to do that is not high:

It used to be more friendly to colocated repos until commit 006c764694a2. I don't think there's much harm in changing it to better match the files in the working copy, as long as we also include the .jj-conflict-* subdirectories (they're needed in order to prevent GC).

Originally posted by @martinvonz in https://github.com/martinvonz/jj/discussions/3970#discussioncomment-9887040

amiryal avatar Jun 27 '24 06:06 amiryal