git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Maaartin <grajcar1@seznam.cz>
Cc: git@vger.kernel.org
Subject: Re: Exlude files from git log -p
Date: Thu, 14 Oct 2010 20:54:57 -0400	[thread overview]
Message-ID: <20101015005457.GA13334@sigill.intra.peff.net> (raw)
In-Reply-To: <loom.20101014T214508-466@post.gmane.org>

On Thu, Oct 14, 2010 at 08:06:26PM +0000, Maaartin wrote:

> Is it possible to exclude a couple of files from the output generated by "git 
> log -p"? Enumerating all other files/dirs is not an option for me.

Not directly. Excluding files from diffs is something that is sometimes
requested, but nobody has implemented it yet.

But...

> Background: Some files in my repo are generated source code and often contain 
> quite a lot of changes. Their generation can't be done in a fully automatic 
> fashion and it happens that it gets forgotten; that's why I need to version them 
> as well.
> 
> I'm thinking about marking them as binary, this should remove their lines from 
> the output, but it would make their comparison impossible (at least AFAIK).

For a situation like this, where you almost always want them ignored,
you can mark them with a special diff driver in .gitattributes. And then
you can either use a null textconv for that driver (which will give you
a diff header when they change, but the contents of the diff will always
be empty), or you can write a custom external diff (in which case you
can remove them from the output entirely).

When you wanted to see them, you could just tweak the config (which
makes it really not that much different than marking them as binary), or
if you wanted to get fancy, your custom external diff could look at some
environment variable, allowing you to do:

  git log -p ;# custom diff ignores certain files
  DIFF_INVISIBLE=1 git log -p ;# show all

or something like that.

-Peff

      reply	other threads:[~2010-10-15  0:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-14 20:06 Exlude files from git log -p Maaartin
2010-10-15  0:54 ` Jeff King [this message]

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

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

  git send-email \
    --in-reply-to=20101015005457.GA13334@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=grajcar1@seznam.cz \
    /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.
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 NNTP newsgroup(s).