{"thread":{"id":"53280","subject":"Missing “git diff” functionality","startedAt":"2020-04-21T21:26:34Z","lastAt":"2020-04-21T21:26:34Z","messageCount":1,"participants":["Thorsten Glaser"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"395867","messageId":"Pine.BSM.4.64L.2004212007350.25168@herc.mirbsd.org","threadId":"53280","inReplyTo":null,"subject":"Missing “git diff” functionality","fromName":"Thorsten Glaser","fromEmail":"tg@debian.org","sentAt":"2020-04-21T20:17:11Z","receivedAt":"2020-04-21T21:26:34Z","isPatch":false,"sender":{"key":"tg@debian.org","avatar":"https://avatars.githubusercontent.com/u/861078?v=4"},"body":"Hi,\n\nI’d like to ask whether adding two, if not three, functionalities\nto “git diff” is possible and has any takers.\n\nThe first two are relatively straightforward and already exist\nin at least GNU diff (as incorporated in GNU CVS, for example).\n\n\n       -I, --ignore-matching-lines=RE\n              ignore changes where all lines match RE\n\nI use this like\n\tcvs diff -uprOLDTAG -I '[$]OtherBSD:.*[$]'\nand missed this in git dearly.\n\n\n       -x, --exclude=PAT\n              exclude files that match PAT\n\n       -X, --exclude-from=FILE\n              exclude files that match any pattern in FILE\n\nI used to do 'diff -pruN -x CVS -x .git cvscheckout gitcheckout | less'\nbut have recently become accustomed to…\n  alias cdiff='git diff --color=always --no-index --no-prefix'\n  alias cwdiff='git diff --color=always --no-index --no-prefix --word-diff'\n  alias cwdiffc='git diff --color=always --no-index --no-prefix --word-diff-regex=.'\n… and doing a 'cdiff cvscheckout gitcheckout' lacks this exclusion.\n\n\nThirdly, there’s some functionality in GNU diff to make the content\nnot begin at the second/third column but at the eigth, so tabs don’t\nbreak in the output. The resulting diff is obviously not a valid\nunidiff, but…\n\n@@ foo @@\n     if (bar)\n-\tbaz(1);\n+        baz(2);\n\n… reads different from…\n\n@@ foo @@\n\t    if (bar)\n-\t\tbaz(1);\n+\t        baz(2);\n\n… and while only the first one is unidiff, the second one has its\nuses (especially in plaintext files with tab-formatted tables) for\nhuman consumption. Basically, you replace the leading space with\na HT for unchanged lines and add one after the +/- for the others.\n\n\nThanks for your consideration,\n//mirabilos\n\nPS: https://github.com/mirabilos/git-find still wishes to be\n    merged into git.git (I asked for this… years ago?), and\n    https://github.com/mirabilos/recvhook/tree/standalone is\n    my merge-back-able attempt at improving post-receive-email\n    which got neglected upstream and wants back…\n-- \n„Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund,\nmksh auf jedem System zu installieren.“\n\t-- XTaran auf der OpenRheinRuhr, ganz begeistert\n(EN: “[…]uhr.gz is a reason to install mksh on every system.”)\n"}]}