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

[Feature] Ability to exclude files from diffs #12653

Closed
hanabanashiku opened this issue Aug 30, 2020 · 3 comments · Fixed by #16773
Closed

[Feature] Ability to exclude files from diffs #12653

hanabanashiku opened this issue Aug 30, 2020 · 3 comments · Fixed by #16773
Labels
issue/bounty This issue has a bounty associated. Whoever opens a PR and gets it merged can claim the bounty. type/enhancement An improvement of existing functionality

Comments

@hanabanashiku
Copy link

hanabanashiku commented 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

@lafriks lafriks added the type/enhancement An improvement of existing functionality label Nov 5, 2020
@mattdavis90
Copy link

mattdavis90 commented 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 - libgit2/libgit2#3676

@kdumontnu kdumontnu added the issue/bounty This issue has a bounty associated. Whoever opens a PR and gets it merged can claim the bounty. label Jun 24, 2021
@kdumontnu

This comment has been minimized.

@mattdavis90
Copy link

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

zeripath added a commit that referenced this issue Sep 9, 2021
…guage stats and diffs (#16773)

Replaces #16262
Replaces #16250
Replaces #14833

This PR first implements a `git check-attr` pipe reader - using `git check-attr --stdin -z --cached` - taking account of the change in the output format in git 1.8.5 and creates a helper function to read a tree into a temporary index file for that pipe reader.

It then wires this in to the language stats helper and into the git diff generation.

Files which are marked generated will be folded by default.

Fixes #14786
Fixes #12653
@zeripath zeripath reopened this Oct 18, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/bounty This issue has a bounty associated. Whoever opens a PR and gets it merged can claim the bounty. type/enhancement An improvement of existing functionality
Projects
None yet
5 participants