3 ms·
The issue with with terminal handling of escape sequences, rather than with git. If you are concerned, you can use a gui diff tool, or you can pipe it through
by kbutler 9y ago
The issue with with terminal handling of escape sequences, rather than with git.
If you are concerned, you can use a gui diff tool, or you can pipe it through a filter that removes escape codes:
seal:~/work/gitPocDiff$ cat > uncolor
#!/usr/bin/env perl
## uncolor — remove terminal escape sequences such as color changes
while (<>) {
s/ \e[ #%()*+\-.\/]. |
(?:\e\[|\x9b) [ -?]* [@-~] | # CSI ... Cmd
(?:\e\]|\x9d) .*? (?:\e\\|[\a\x9c]) | # OSC ... (ST|BEL)
(?:\e[P^_]|[\x90\x9e\x9f]) .*? (?:\e\\|\x9c) | # (DCS|PM|APC) ... ST
\e.|[\x80-\x9f] //xg;
print;
}
seal:~/work/gitPocDiff$ chmod a+x uncolor
seal:~/work/gitPocDiff$ git diff eeeb ebc3 | ./uncolor
diff --git a/main.c b/main.c
index 6daa9b2..0321ff2 100644
--- a/main.c
+++ b/main.c
@@ -3,4 +3,9 @@
int main()
{
printf("I'm just a stub!\n");
+ /*
+ * Must always return a value Hidden > */printf("Insert bad backdoor here...!\n");/*
+ * TODO: Return result
+ */
+ return 0;
}
Credit to: gilles https://unix.stackexchange.com/a/14707 https://unix.stackexchange.com/a/14707
- realusername 9y agoYou can also just pipe it to cat -e, it works the same. git diff | cat -e make all escape sequences visible.
- kbutler 9y agoThere's always a utility... Thanks!