-
Notifications
You must be signed in to change notification settings - Fork 632
Closed
Description
tig
sometimes crashes when git
is configured to use word-diff
with
[diff]
wordRegex="[^[:space:]]|([[:alnum:]]|UTF_8_GUARD|\\.|-)+"
Building with 'make all-debug' reveals
Assertion failed: (ARRAY_SIZE(context->cell) > context->cells), function diff_common_add_cell, file src/diff.c, line 95.
Process 24277 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = hit program assert
frame #4: 0x00000001000307ec tig`diff_common_add_cell(context=0x00007ffeefbfd590, length=20, allow_empty=false) at diff.c:95:2
92 static bool
93 diff_common_add_cell(struct diff_stat_context *context, size_t length, bool allow_empty)
94 {
-> 95 assert(ARRAY_SIZE(context->cell) > context->cells);
96 if (!allow_empty && (length == 0))
97 return true;
98 if (context->skip && !argv_appendn(&context->cell_text, context->text, length))
The failure above is with
git clone https://github.com/achim/multiset
tig -C multiset show 84194ef30d6e579e3338610c9077347c22b73c12
which needs 400 cells.
I have found that
git clone https://github.com/jquery/jquery
tig -C jquery show 0b2c36adb4e2c048318659e4196e0925da10ead2
needs 6964 cells.
One solution could be to simply increase the size of the cell array with
diff --git a/src/diff.c b/src/diff.c
index 9a1600e2..58415253 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -86,7 +86,7 @@ struct diff_stat_context {
bool skip;
size_t cells;
const char **cell_text;
- struct box_cell cell[256];
+ struct box_cell cell[8192];
};
static bool
or maybe add a configuration option - something like max-cells
?
Another solution might be to stop adding to the cell array if it is full-1 and instead add a message that the diff has been truncated in the last position.
Metadata
Metadata
Assignees
Labels
No labels