git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Missing “git diff” functionality
@ 2020-04-21 20:17 Thorsten Glaser
  0 siblings, 0 replies; only message in thread
From: Thorsten Glaser @ 2020-04-21 20:17 UTC (permalink / raw)
  To: git

Hi,

I’d like to ask whether adding two, if not three, functionalities
to “git diff” is possible and has any takers.

The first two are relatively straightforward and already exist
in at least GNU diff (as incorporated in GNU CVS, for example).


       -I, --ignore-matching-lines=RE
              ignore changes where all lines match RE

I use this like
	cvs diff -uprOLDTAG -I '[$]OtherBSD:.*[$]'
and missed this in git dearly.


       -x, --exclude=PAT
              exclude files that match PAT

       -X, --exclude-from=FILE
              exclude files that match any pattern in FILE

I used to do 'diff -pruN -x CVS -x .git cvscheckout gitcheckout | less'
but have recently become accustomed to…
  alias cdiff='git diff --color=always --no-index --no-prefix'
  alias cwdiff='git diff --color=always --no-index --no-prefix --word-diff'
  alias cwdiffc='git diff --color=always --no-index --no-prefix --word-diff-regex=.'
… and doing a 'cdiff cvscheckout gitcheckout' lacks this exclusion.


Thirdly, there’s some functionality in GNU diff to make the content
not begin at the second/third column but at the eigth, so tabs don’t
break in the output. The resulting diff is obviously not a valid
unidiff, but…

@@ foo @@
     if (bar)
-	baz(1);
+        baz(2);

… reads different from…

@@ foo @@
	    if (bar)
-		baz(1);
+	        baz(2);

… and while only the first one is unidiff, the second one has its
uses (especially in plaintext files with tab-formatted tables) for
human consumption. Basically, you replace the leading space with
a HT for unchanged lines and add one after the +/- for the others.


Thanks for your consideration,
//mirabilos

PS: https://github.com/mirabilos/git-find still wishes to be
    merged into git.git (I asked for this… years ago?), and
    https://github.com/mirabilos/recvhook/tree/standalone is
    my merge-back-able attempt at improving post-receive-email
    which got neglected upstream and wants back…
-- 
„Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund,
mksh auf jedem System zu installieren.“
	-- XTaran auf der OpenRheinRuhr, ganz begeistert
(EN: “[…]uhr.gz is a reason to install mksh on every system.”)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-21 21:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 20:17 Missing “git diff” functionality Thorsten Glaser

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).