Skip to content

[Feature] Ability to exclude files from diffs #12653

@hanabanashiku

Description

@hanabanashiku

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

Activity

mattdavis90

mattdavis90 commented on Feb 5, 2021

@mattdavis90

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

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

kdumontnu commented on Jun 24, 2021

@kdumontnu
mattdavis90

mattdavis90 commented on Jun 25, 2021

@mattdavis90

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

added a commit that references this issue on Sep 9, 2021
248b96d
locked and limited conversation to collaborators on Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/bountyThis issue has a bounty associated. Whoever opens a PR and gets it merged can claim the bounty.type/enhancementAn improvement of existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @lafriks@zeripath@mattdavis90@kdumontnu@hanabanashiku

      Issue actions

        [Feature] Ability to exclude files from diffs · Issue #12653 · go-gitea/gitea