ndimiduk commented on PR #384:
URL: https://github.com/apache/yetus/pull/384#issuecomment-4404573422

   Okay I think I tracked this down. Looks like `git apply` processes 
per-commit `format-patch` stanzas sequentially against the working tree, but 
each stanza's precondition check assumes the file is in its pre-stanza state — 
not the state left by earlier stanzas. When a file is created in commit 1, 
modified in commit 2, and deleted in commit 3, the delete stanza silently 
succeeds (exit 0) without actually removing the file. `git apply --check` 
(dry-run) also passes, because it validates stanzas independently rather than 
simulating the cumulative effect (using MacOS git 2.50.1). I added a bats test 
that I think reproduces.
   
   The cumulative `git diff` output doesn't have this problem — it represents 
the net change from base to HEAD as a single stanza per file. A file that was 
added and later deleted simply doesn't appear. A file that was added and later 
renamed appears only at its final path.
   
   In the patch I swap the logic of `dryrun_both_files` to prefer the 
cumulative `.diff` over the per-commit `.patch`. The `.patch` is kept as a 
fallback.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to