git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: "Udoff, Marc" <Marc.Udoff@deshaw.com>
Cc: "Shupak, Vitaly" <Vitaly.Shupak@deshaw.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git filter bug
Date: Sat, 11 Jun 2022 09:43:12 +0200	[thread overview]
Message-ID: <442e3166-4f18-3ee0-e3bc-d24687471d5c@kdbg.org> (raw)
In-Reply-To: <101027c97a9b40ce97192b1cee203b07@deshaw.com>

Am 11.06.22 um 00:19 schrieb Udoff, Marc:
> Hi,
> 
> I believe there is a bug in git status that happens when a file
> changes but the filtered version of the file does not. Correctly,
> git diff does not show anything as different and git commit believes
> there is nothing to commit.
> 
> Reproducer:
> $ git init
> $ touch bar
> $ git add bar
> $ git commit -am 'Bar'
> [main (root-commit) dd12b3e] Bar
> 1 file changed, 0 insertions(+), 0 deletions(-)
> create mode 100644 bar
> $ echo -en '\n[filter "noat"]\n     clean = grep -v "@"\n' >> .git/config
> $ cat .git/config 
> [core]
>         repositoryformatversion = 0
>         filemode = true
>         bare = false
>         logallrefupdates = true
> 
> [filter "noat"]
>      clean = grep -v "@"
> $ echo -en 'abc\n@def\nghi\n' > bar 
> $ cat bar 
> abc
> @def
> ghi
> $ echo "* filter=noat" > .gitattributes
> $ git commit -am 'No at bar'
> [main e81ee3b] No at bar
> 2 files changed, 3 insertions(+)
> create mode 100644 .gitattributes
> $ git show HEAD:bar
> abc
> ghi
> $ echo "@another line" >> bar # Add another @ which will be filtered. touch doesn't cause this bug
> $ git status --porcelain
> M bar

git status does not compute differences; it only looks at the stat
information, and that is by design for performance reasons. So, IMO,
this is working as designed and not a bug.

-- Hannes

  reply	other threads:[~2022-06-11  8:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10 22:19 git filter bug Udoff, Marc
2022-06-11  7:43 ` Johannes Sixt [this message]
2022-06-13 17:29   ` Junio C Hamano
2022-06-13 21:15     ` Johannes Sixt
2022-06-14 19:11       ` Shupak, Vitaly
2022-06-23 12:13         ` Udoff, Marc

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=442e3166-4f18-3ee0-e3bc-d24687471d5c@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=Marc.Udoff@deshaw.com \
    --cc=Vitaly.Shupak@deshaw.com \
    --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).