Skip to content

Commit bea084b

Browse files
phillipwoodgitster
authored andcommitted
diff --color-moved: clear all flags on blocks that are too short
If a block of potentially moved lines is not long enough then the DIFF_SYMBOL_MOVED_LINE flag is cleared on the matching lines so they are not marked as moved. To avoid problems when we start rewinding after an unsuccessful match in a couple of commits time make sure all the move related flags are cleared, not just DIFF_SYMBOL_MOVED_LINE. Signed-off-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f73613a commit bea084b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

diff.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,8 @@ static int shrink_potential_moved_blocks(struct moved_block *pmb,
11141114
* NEEDSWORK: This uses the same heuristic as blame_entry_score() in blame.c.
11151115
* Think of a way to unify them.
11161116
*/
1117+
#define DIFF_SYMBOL_MOVED_LINE_ZEBRA_MASK \
1118+
(DIFF_SYMBOL_MOVED_LINE | DIFF_SYMBOL_MOVED_LINE_ALT)
11171119
static int adjust_last_block(struct diff_options *o, int n, int block_length)
11181120
{
11191121
int i, alnum_count = 0;
@@ -1130,7 +1132,7 @@ static int adjust_last_block(struct diff_options *o, int n, int block_length)
11301132
}
11311133
}
11321134
for (i = 1; i < block_length + 1; i++)
1133-
o->emitted_symbols->buf[n - i].flags &= ~DIFF_SYMBOL_MOVED_LINE;
1135+
o->emitted_symbols->buf[n - i].flags &= ~DIFF_SYMBOL_MOVED_LINE_ZEBRA_MASK;
11341136
return 0;
11351137
}
11361138

@@ -1237,8 +1239,6 @@ static void mark_color_as_moved(struct diff_options *o,
12371239
free(pmb);
12381240
}
12391241

1240-
#define DIFF_SYMBOL_MOVED_LINE_ZEBRA_MASK \
1241-
(DIFF_SYMBOL_MOVED_LINE | DIFF_SYMBOL_MOVED_LINE_ALT)
12421242
static void dim_moved_lines(struct diff_options *o)
12431243
{
12441244
int n;

0 commit comments

Comments
 (0)