Skip to content

git-apply --whitespace=fix updates

Junio C Hamano git 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13builtin-apply.c: refactor small part that matches contextbuiltin-apply.c+13 -50 replies
2/13builtin-apply.c: restructure "offset" matchingbuiltin-apply.c+25 -240 replies
3/13builtin-apply.c: push match-beginning/end logic downbuiltin-apply.c+32 -140 replies
4/13builtin-apply.c: make it more line orientedbuiltin-apply.c+280 -1230 replies
5/13builtin-apply.c: optimize match_beginning/end processing a bit.builtin-apply.c+10 -00 replies
6/13builtin-apply.c: mark common context lines in lineinfo structure.builtin-apply.c+32 -250 replies
7/13builtin-apply.c: clean-up apply_one_fragment()builtin-apply.c+27 -280 replies
8/13builtin-apply.c: simplify calling site to apply_line()builtin-apply.c+20 -180 replies
9/13builtin-apply.c: do not feed copy_wsfix() leading '+'builtin-apply.c+18 -200 replies
10/13builtin-apply.c: move copy_wsfix() function a bit higher.builtin-apply.c+94 -940 replies
11/13builtin-apply.c: pass ws_rule down to match_fragment()builtin-apply.c+5 -30 replies
12/13git-apply --whitespace=fix: fix whitespace fuzz introduced by previous runbuiltin-apply.c t/t4125-apply-ws-fuzz.sh+231 -50 replies
13/13core.whitespace: cr-at-eolDocumentation/config.txt builtin-apply.c cache.h +2 more+72 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH/RFC 00/13] git-apply --whitespace=fix updates

This mini-series teaches "git-apply --whitespace=fix" to cope better with the whitespace changes it introduces to the context.

[PATCH 01/13] builtin-apply.c: refactor small part that matches context [PATCH 02/13] builtin-apply.c: restructure "offset" matching [PATCH 03/13] builtin-apply.c: push match-beginning/end logic down

These three are preparatory clean-ups to isolate the parts the later patches need to update.

[PATCH 04/13] builtin-apply.c: make it more line oriented
[PATCH 05/13] builtin-apply.c: optimize match_beginning/end processing a bit. [PATCH 06/13] builtin-apply.c: mark common context lines in lineinfo structure.

These introduce an array of hash values for each line in the patch preimage, postimage and the target file, and simplifies the code to find the place that the hunk applies. The ultimate motivation is to allow applying patches with whitespace differences, but this step does not do that yet.

The matching logic that uses hash code of lines could also make it faster to find the place the hunk applies to, but that is not the primary purpose of the change. We would however need to bench it so that this does not at least slow it down too much. I haven't done that yet.

[PATCH 07/13] builtin-apply.c: clean-up apply_one_fragment()

This reduces 3 variables (old, oldlines, oldsize) that keep track of the preimage being built (and their "new" counterparts for the postimage) to 2 variables (old, oldlines). This cannot be done cleanly without the conversion to a line oriented data structure introduced by 04/13 (remove_first_line() is the most problematic one).

[PATCH 08/13] builtin-apply.c: simplify calling site to apply_line() [PATCH 09/13] builtin-apply.c: do not feed copy_wsfix() leading '+' [PATCH 10/13] builtin-apply.c: move copy_wsfix() function a bit higher.

The function apply_line() reads one line of a patch and makes whitespace corrections. These three are preparatory steps to make the function usable for correcting whitespaces in context lines. The function is renamed to copy_wsfix().

[PATCH 11/13] builtin-apply.c: pass ws_rule down to match_fragment() [PATCH 12/13] git-apply --whitespace=fix: fix whitespace fuzz introduced by previous run

This actually implements the application of a patch whose preimage context lines do not match the target file but do match if the whitespace breakages in them are corrected. The fixing goes the other way as well. We may still have files with whitespace breakages, and the submitter may have based the patch on a tree whose whitespace breakages have been fixed. In such a case, the lines in the target file needs to be cleaned up and compared with the cleaned-up context lines from the preimage of the patch.

[PATCH 13/13] core.whitespace: cr-at-eol

This introduces a new error mode "cr-at-eol" which tells git not to treat a CR at the end of line as a trailing whitespace error. This is from my earlier patch sent to the list, and does not depend on "the whitespace correction in the context" topic above, but rebased because it textually conflicts with the series.