diff parsing, regardless of diff-prefix choices#1337
diff parsing, regardless of diff-prefix choices#1337gcb wants to merge 4 commits intojonas:masterfrom
Conversation
naive fix#1336
src/diff.c
Outdated
| break; | ||
| if (!prefixcmp(data, "--- ")) { | ||
| const char *data_n1 = box_text(diff+1); | ||
| const char *data_n2 = box_text(diff+2); |
|
Confess I only went for a patch because it would get the 1337 id... Looking the code just around the error message, I already had all the context to send in a fix in a language i haven't touched in over 15years. The text area here was enough "IDE support". I'm aware this is not "done" code, but was enough to downloaded my branch, build, and get the feature i needed without considering edge cases. Haven't looked at the failing test yet 🙄 Well, just meant this as an appreciation note. Thank you. Had used tig for years, but never had a reason to look at the nice source, which is another compliment I guess. cheers. |
|
7h4nk5 for reporting and trying to fix the issue. Test case is failing because your fix breaks the original prefixed use case. |
|
Thanks for pointing out the test issue! will try to polish this when i get some down time next month, if nobody beat me to it. |
src/diff.c
Outdated
| const char *data_n1 = box_text(diff+1); | ||
| const char *data_n2 = box_text(diff+2); | ||
| if(!prefixcmp(data_n1, "+++ ") && !prefixcmp(data_n2, "@@ ")){ | ||
| file = data + STRING_SIZE("--- "); |
There was a problem hiding this comment.
all these hardcoded strings can probably be from https://github.com/jonas/tig/blob/master/include/tig/line.h#L29
|
also needs to account for |
handle all diff view options (noprefix, mnemonicPrefix, srcPrefix, dstPrefix, line-prefix)
(moved quick fix of #1336 to #1338)