git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git filter bug
@ 2022-06-10 22:19 Udoff, Marc
  2022-06-11  7:43 ` Johannes Sixt
  0 siblings, 1 reply; 6+ messages in thread
From: Udoff, Marc @ 2022-06-10 22:19 UTC (permalink / raw)
  To: git@vger.kernel.org; +Cc: Shupak, Vitaly

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 diff # no output as there is no diff
$ git commit -am "I did not update"
On branch main
nothing to commit, working tree clean


While this reproducer is a bit contrived, the real world examples are with Jupyter notebooks filtering output, so I expect this is a somewhat common occurrence. I think it also may be the same as https://stackoverflow.com/questions/62641222/how-to-make-git-status-consider-the-clean-filter.

Git version: 2.35.1
OS: Linux


Note: I also logged this here, but I believe this mailing list is the correct place to raise the issue: https://github.com/gitgitgadget/git/issues/1256

Thanks,
Marc


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-23 12:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 22:19 git filter bug Udoff, Marc
2022-06-11  7:43 ` Johannes Sixt
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

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