News for hackers. Stuff that matters.
Re:Show HN: Hiding code from Git diff by kbutler on Wednesday December 13, 2017 @07:46PM (#15919070)
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
Re:Show HN: Hiding code from Git diff by realusername on Thursday December 14, 2017 @01:44AM (#15920392)
You can also just pipe it to cat -e, it works the same. git diff | cat -e make all escape sequences visible.
Re:Show HN: Hiding code from Git diff by kbutler on Thursday December 14, 2017 @07:54AM (#15921876)
There's always a utility... Thanks!