Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git filter bug #1256

Closed
mlucool opened this issue Jun 10, 2022 · 2 comments
Closed

git filter bug #1256

mlucool opened this issue Jun 10, 2022 · 2 comments

Comments

@mlucool
Copy link

mlucool commented Jun 10, 2022

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 -en 'abc\n@@def\nghi\n' > bar # Add another @ to the same filtered out line. 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.

@dscho
Copy link
Member

dscho commented Jun 13, 2022

The issue tracker of the GitGitGadget fork is intended to be used for project ideas (e.g. Outreachy, Google Summer of Code, etc).

The Git project expects bug reports on the Git mailing list (send plain-text messages, HTML messages are dropped silently) instead.

@dscho dscho closed this as completed Jun 13, 2022
@dscho
Copy link
Member

dscho commented Jun 14, 2022

For lurkers, this was indeed reported to the correct list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants