.gitattributes does not handle -diff properly in UI
Summary
-diff
option is not working and not suppressing difference in UI when applied in .gitattributes
file.
Note: git CLI works fine with this settings, it's just our UI is not using .gitattributes
Steps to reproduce
- Create a repo with README
- Create a new branch ("test")
- Add the
.gitattributes
file with the following content on "test" branch# cat .gitattributes ignoreme.txt -diff
- Add the "ignoreme.txt" file on "test" branch
# cat ignoreme.txt first line this must be ignored by diff
- Push the changes to the branch "test"
- Observe with CLI git that the diff is suppressed:
git diff main diff --git a/.gitattributes b/.gitattributes index e69de29..d2200ca 100644 --- a/.gitattributes +++ b/.gitattributes @@ -0,0 +1 @@ +ignoreme.txt -diff diff --git a/ignoreme.txt b/ignoreme.txt index 6cc3bfa..d0a2c51 100644 Binary files a/ignoreme.txt and b/ignoreme.txt differ
- Go to GL UI and compare the diff there (or create an MR and check the diff). This will show full content of the
ignoreme.txt
file and will not suppress the diff
What is the current bug behavior?
Diff of a file mentioned in .gitattributes
with flag -diff
is not suppressed in the UI
What is the expected correct behavior?
Diff is hidden in the UI "diff" view
Results of GitLab environment info
Expand for output related to GitLab environment info
``` sudo gitlab-rake gitlab:env:info System information System: Ubuntu 20.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.7.6p219 Gem Version: 3.1.6 Bundler Version:2.3.15 Rake Version: 13.0.6 Redis Version: 6.2.7 Sidekiq Version:6.4.2 Go Version: unknown GitLab information Version: 15.4.6-ee Revision: 4fc991ae59a Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 13.8 URL: https://gitlab-3.26.115.161.nip.io HTTP Clone URL: https://gitlab-3.26.115.161.nip.io/some-group/some-project.git SSH Clone URL: git@gitlab-3.26.115.161.nip.io:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 14.10.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell ```
Possible fixes
Edited by Anton Starovoytov