Fakerr / git-recall

An interactive way to peruse your git history from the terminal
MIT License
2.12k stars 47 forks source link

Escape characters in diff view are not reproduced literally #27

Closed LINKIWI closed 7 years ago

LINKIWI commented 7 years ago

Escape characters (at least newline \n) in the diff view of git-recall seem to be interpreted rather than echoed literally. It's easiest to show with an example:

Expected behavior (output of git diff):

-        char write_char = buf[write_len++];
+        const char write_char = buf[write_len++];

-        if (write_char == '\n') {
+        if (write_char == CHAR_LF) {

Actual behavior (using git reacall, after selecting a diff SHA and pressing enter):

-        char write_char = buf[write_len++];
+        const char write_char = buf[write_len++];

-        if (write_char == '
') {
+        if (write_char == CHAR_LF) {

This behavior occurs on v1.1.2 (haven't used any earlier versions, so unsure if this is a regression or not).

LINKIWI commented 7 years ago

Seems like this could be caused by the -e option on echo at https://github.com/Fakerr/git-recall/blob/master/git-recall#L173

Fakerr commented 7 years ago

@LINKIWI Indeed, removing them will fix the issue. Thanks for reporting this :), I'll add fix.

Fakerr commented 7 years ago

Issue fixed.