git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Thorsten Glaser <tg@debian.org>
To: git@vger.kernel.org
Subject: Missing “git diff” functionality
Date: Tue, 21 Apr 2020 20:17:11 +0000 (UTC)	[thread overview]
Message-ID: <Pine.BSM.4.64L.2004212007350.25168@herc.mirbsd.org> (raw)

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.”)

                 reply	other threads:[~2020-04-21 21:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.BSM.4.64L.2004212007350.25168@herc.mirbsd.org \
    --to=tg@debian.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).