Skip to content

Add a Git_ext Copy operation to copy (and eventually edit afterwards) - #44

Open
hannesm wants to merge 1 commit into
mainfrom
add-copy
Open

Add a Git_ext Copy operation to copy (and eventually edit afterwards)#44
hannesm wants to merge 1 commit into
mainfrom
add-copy

Conversation

@hannesm

@hannesm hannesm commented Jun 9, 2026

Copy link
Copy Markdown
Owner

The reasoning is that, as far as I can tell, there can be git diffs where a file is copied and afterwards modified. This means the common Edit operation doesn't fully fit.

One such example is #43

This needs some attention from @kit-ty-kate @shym and maybe @edwintorok

The reasoning is that, as far as I can tell, there can be git diffs where a file
is copied and afterwards modified. This means the common Edit operation doesn't
fully fit.

One such example is #43
@hannesm

hannesm commented Jun 9, 2026

Copy link
Copy Markdown
Owner Author

As suggested in #43, this needs some tests, and it also doesn't feel very principled:

  • is it fine to skip (without warning) a hunk that has already been applied?
  • is the git copy operation really needed? Is the semantics of Edit really if a and b are different to remove a after the operation?
  • In opatch, the let create = ... in now looks very hand-wavy, it would be nice to have a better story there.

@edwintorok

edwintorok commented Jun 29, 2026

Copy link
Copy Markdown

See #43 (comment), I've found some documentation on how this is supposed to work in git diff, but implementing that in opatch would be tricky, because it'd require preserving all the original files, in particular there is this bit of non-POSIX behaviour:

All the file1 files in the output refer to files before the commit, and all the file2 files refer to files after the commit. It is incorrect to apply each change to each file sequentially

JasonGross added a commit to mit-plv/fiat-crypto that referenced this pull request Jul 13, 2026
…bug (#2360)

ocaml/setup-ocaml@v3 already runs `opam update` after restoring its
cache, so the explicit `opam update` step re-updates an
already-up-to-date repository.  With opam 2.5.1 this second update can
fail with

    OpamSystem.Internal_patch_error("Patch \"in directory
    /Users/runner/.opam/repo/default\" does not apply cleanly.")

because opam's internal patch implementation does not reliably handle
rename/copy-related git diff output (ocaml/opam#6937, fix pending in
ocaml/opam#6992 / hannesm/patch#44); see also
ocaml/setup-ocaml#1108 (comment).

Removing the redundant update sidesteps the bug entirely.

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants