Skip to content

reroll of sb/diff-color-moved

Stefan Beller git 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest25 patches 2 repliesIn review
  2. v126 patches 31 repliesSuperseded

Changes in v2 from the cover letter

* addressed all issues raised
* last patch dropped (WIP/RFC: diff.c: have a "machine parseable" move coloring)
* interdiff below

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/25diff.c: readability fixdiff.c+2 -20 replies
2/25diff.c: move line ending check into emit_hunk_headerdiff.c+2 -20 replies
3/25diff.c: factor out diff_flush_patch_all_file_pairsdiff.c+12 -50 replies
4/25diff.c: introduce emit_diff_symboldiff.c+19 -32 replies
5/25diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_MARKERdiff.c+9 -10 replies
6/25diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_FRAGINFOdiff.c+6 -20 replies
7/25diff.c: emit_diff_symbol learns DIFF_SYMBOL_NO_LF_EOFdiff.c+11 -80 replies
8/25diff.c: migrate emit_line_checked to use emit_diff_symbolcache.h diff.c diff.h+80 -440 replies
9/25diff.c: emit_diff_symbol learns DIFF_SYMBOL_WORDS[_PORCELAIN]diff.c+26 -160 replies
10/25diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_INCOMPLETEdiff.c+4 -20 replies
11/25diff.c: emit_diff_symbol learns DIFF_SYMBOL_FILEPAIR_{PLUS, MINUS}diff.c+30 -210 replies
12/25diff.c: emit_diff_symbol learns DIFF_SYMBOL_HEADERdiff.c+20 -80 replies
13/25diff.c: emit_diff_symbol learns about DIFF_SYMBOL_BINARY_FILESdiff.c+15 -50 replies
14/25diff.c: emit_diff_symbol learns DIFF_SYMBOL_REWRITE_DIFFdiff.c+21 -140 replies
15/25submodule.c: migrate diff output to use emit_diff_symboldiff.c diff.h submodule.c +1 more+122 -680 replies
16/25diff.c: convert emit_binary_diff_body to use emit_diff_symboldiff.c+46 -170 replies
17/25diff.c: convert show_stats to use emit_diff_symboldiff.c diff.h+74 -440 replies
18/25diff.c: convert word diffing to use emit_diff_symboldiff.c+46 -330 replies
19/25diff.c: emit_diff_symbol learns about DIFF_SYMBOL_STAT_SEPdiff.c+7 -30 replies
20/25diff.c: emit_diff_symbol learns about DIFF_SYMBOL_SUMMARYdiff.c+41 -300 replies
21/25diff.c: buffer all output if asked todiff.c diff.h+109 -20 replies
22/25diff.c: color moved lines differentlydiff.c diff.h t/t4015-diff-whitespace.sh+494 -150 replies
23/25diff.c: color moved lines differently, plain modediff.c diff.h t/t4015-diff-whitespace.sh+56 -10 replies
24/25diff.c: add dimming to moved line detectioncolor.h diff.c diff.h +1 more+259 -150 replies
25/25diff: document the new --color-moved settingDocumentation/config.txt Documentation/diff-options.txt+37 -20 replies

Reviews trailers per patch

None of the 25 patches has a Reviewed-by or Acked-by.

PatchJonathan Tan
1/25
2/25
3/25
4/25
5/25
6/25
7/25
8/25
9/25
10/25
11/25
12/25
13/25
14/25
15/25
16/25
17/25
18/25
19/25
20/25
21/25
22/25Helped-by
23/25
24/25
25/25

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCHv2 00/25] reroll of sb/diff-color-moved

v2:
* addressed all issues raised
* last patch dropped (WIP/RFC: diff.c: have a "machine parseable" move coloring)
* interdiff below

v1:
This is a complete rewrite of the series. Highlights:
* instead of buffering partial lines, we'll pretend all diff output follows a well defined grammar, and we emit symbols thereof. (The difference is mostly mental, though by this trick we reduce the memory footprint for storing one of these symbols from 7 variables (3 pointers, 3 ints, one state (also int) down to 4 variables (one pointer, 2 ints, one state).
* The algorithm for color painting was detangled:
-> different functions for block detection and dimming
-> The last patch (not to be applied) is an RFC that shows
how we would approach non-colored, but machine parseable highlighting of moved lines.

Thanks,
Stefan

Stefan Beller (25):
diff.c: readability fix
diff.c: move line ending check into emit_hunk_header diff.c: factor out diff_flush_patch_all_file_pairs diff.c: introduce emit_diff_symbol
diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_MARKER diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_FRAGINFO diff.c: emit_diff_symbol learns DIFF_SYMBOL_NO_LF_EOF diff.c: migrate emit_line_checked to use emit_diff_symbol diff.c: emit_diff_symbol learns DIFF_SYMBOL_WORDS[_PORCELAIN] diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_INCOMPLETE diff.c: emit_diff_symbol learns DIFF_SYMBOL_FILEPAIR_{PLUS, MINUS} diff.c: emit_diff_symbol learns DIFF_SYMBOL_HEADER diff.c: emit_diff_symbol learns about DIFF_SYMBOL_BINARY_FILES diff.c: emit_diff_symbol learns DIFF_SYMBOL_REWRITE_DIFF submodule.c: migrate diff output to use emit_diff_symbol diff.c: convert emit_binary_diff_body to use emit_diff_symbol diff.c: convert show_stats to use emit_diff_symbol diff.c: convert word diffing to use emit_diff_symbol diff.c: emit_diff_symbol learns about DIFF_SYMBOL_STAT_SEP diff.c: emit_diff_symbol learns about DIFF_SYMBOL_SUMMARY diff.c: buffer all output if asked to
diff.c: color moved lines differently
diff.c: color moved lines differently, plain mode diff.c: add dimming to moved line detection
diff: document the new --color-moved setting

 Documentation/config.txt       |   12 +-
 Documentation/diff-options.txt |   27 +
 cache.h                        |    2 +
 color.h                        |    2 +
 diff.c                         | 1270 ++++++++++++++++++++++++++++++++--------
 diff.h                         |   37 +-
 submodule.c                    |   85 ++-
 submodule.h                    |   13 +-
 t/t4015-diff-whitespace.sh     |  369 ++++++++++++
 9 files changed, 1501 insertions(+), 316 deletions(-)

diff to what is currently queued:

cache.h +1 -0
index 4d63c44f07..d2204bf6d1 100644
@@ -2168,6 +2168,7 @@ void shift_tree_by(const struct object_id *, const struct object_id *, struct ob
 #define WS_TRAILING_SPACE      (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)
 #define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)
 #define WS_TAB_WIDTH_MASK        077
+/* All WS_* -- when extended, adapt diff.c emit_symbol */
 #define WS_RULE_MASK           07777
 extern unsigned whitespace_rule_cfg;
 extern unsigned whitespace_rule(const char *);
color.h +2 -2
index 0e091b0cf5..fd2b688dfb 100644
@@ -42,8 +42,8 @@ struct strbuf;
 #define GIT_COLOR_BG_BLUE	"\033[44m"
 #define GIT_COLOR_BG_MAGENTA	"\033[45m"
 #define GIT_COLOR_BG_CYAN	"\033[46m"
-#define GIT_COLOR_DI		"\033[2m"
-#define GIT_COLOR_DI_IT		"\033[2;3m"
+#define GIT_COLOR_FAINT		"\033[2m"
+#define GIT_COLOR_FAINT_ITALIC	"\033[2;3m"
 
 /* A special value meaning "no color selected" */
 #define GIT_COLOR_NIL "NIL"
diff.c +84 -90

334 lines not on this page · raw message

Signature · 1 line
2.12.2.575.gb14f27f917