[Feature] Ability to exclude files from diffs #5920

Closed
opened 2025-11-02 06:40:18 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @hanabanashiku on GitHub (Aug 30, 2020).

Github uses Linguist for code analysis in its repositories, and resulting from that introduced a nifty feature in its .gitattributes definitions: linguist-generated. This attribute can be used to exclude specific file types from diffs, code reviews, and hide it from showing in the file listing.
I've found that to be invaluable to working with Unity3D in order to keep .meta and .prefab files from cluttering code reviews. It would be cool to have a similar feature in Gitea


Bountysource

Originally created by @hanabanashiku on GitHub (Aug 30, 2020). Github uses Linguist for code analysis in its repositories, and resulting from that introduced a nifty feature in its .gitattributes definitions: `linguist-generated`. This attribute can be used to exclude specific file types from diffs, code reviews, and hide it from showing in the file listing. I've found that to be invaluable to working with Unity3D in order to keep .meta and .prefab files from cluttering code reviews. It would be cool to have a similar feature in Gitea --- [![Bountysource](https://api.bountysource.com/badge/issue?issue_id=92731348)](https://www.bountysource.com/issues/92731348-feature-ability-to-exclude-files-from-diffs)
GiteaMirror added the issue/bountytype/enhancement labels 2025-11-02 06:40:18 -06:00
Author
Owner

@mattdavis90 commented on GitHub (Feb 5, 2021):

This would be a great feature. An alternative to the linguist-generated attribute, might be having gitea observe the -diff and -merge attributes.

Edit: Reading around and testing on my own gitea setup it looks as though the .gitattributes file may not be available within bare repos - https://github.com/libgit2/libgit2/issues/3676

@mattdavis90 commented on GitHub (Feb 5, 2021): This would be a great feature. An alternative to the `linguist-generated` attribute, might be having gitea observe the `-diff` and `-merge` attributes. Edit: Reading around and testing on my own gitea setup it looks as though the `.gitattributes` file may not be available within bare repos - https://github.com/libgit2/libgit2/issues/3676
Author
Owner

@kdumontnu commented on GitHub (Jun 24, 2021):

Bounty available Bountysource

If you'd like to promote this, please add

[![Bountysource](https://api.bountysource.com/badge/issue?issue_id=92731348)](https://www.bountysource.com/issues/92731348-feature-ability-to-exclude-files-from-diffs)

To the issue summary

@kdumontnu commented on GitHub (Jun 24, 2021): Bounty available [![Bountysource](https://api.bountysource.com/badge/issue?issue_id=92731348)](https://www.bountysource.com/issues/92731348-feature-ability-to-exclude-files-from-diffs) If you'd like to promote this, please add ``` [![Bountysource](https://api.bountysource.com/badge/issue?issue_id=92731348)](https://www.bountysource.com/issues/92731348-feature-ability-to-exclude-files-from-diffs) ``` To the issue summary
Author
Owner

@mattdavis90 commented on GitHub (Jun 25, 2021):

@KN4CK3R You beat me to it, with a much cleaner solution 😄 Was fun to play around though.

My less elegant approach is here in case there is anything of use.

It attempts to find the .gitattributes file on the current commit and temporarily stores it in <repo>/info/attributes so that it is available to the git diff command later. A little hacky, and I'm sure there is probably an issue if two API calls come in together.

@mattdavis90 commented on GitHub (Jun 25, 2021): @KN4CK3R You beat me to it, with a much cleaner solution :smile: Was fun to play around though. My less elegant approach is [here](https://github.com/mattdavis90/gitea/commit/91e04f8bfd24ba3ef0aed5b75a16a1f1e08fb29c) in case there is anything of use. It attempts to find the `.gitattributes` file on the current commit and temporarily stores it in `<repo>/info/attributes` so that it is available to the `git diff` command later. A little hacky, and I'm sure there is probably an issue if two API calls come in together.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5920