Add option to exclude directories in diff (pull request) #1852

Closed
opened 2025-11-02 04:15:10 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @jraats on GitHub (Jun 4, 2018).

  • Gitea version (or commit ref): 1.4.0
  • Git version: 2.1.4
  • Operating system: Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

We build a lot of GO code and include the vendor directory (go-dep). The diff of our pull requests are extremely large due all the files in the vendor directory. Is is possible to add a configuration in the app.ini to let Gitea know which directories to exclude? E.g. "./vendor"

Screenshots

Originally created by @jraats on GitHub (Jun 4, 2018). - Gitea version (or commit ref): 1.4.0 - Git version: 2.1.4 - Operating system: Linux - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description We build a lot of GO code and include the vendor directory (go-dep). The diff of our pull requests are extremely large due all the files in the vendor directory. Is is possible to add a configuration in the app.ini to let Gitea know which directories to exclude? E.g. "./vendor" ## Screenshots
GiteaMirror added the type/proposaltype/feature labels 2025-11-02 04:15:10 -06:00
Author
Owner

@jraats commented on GitHub (Jun 18, 2018):

How do you guys want to implement this? Is a global configuration via the INI file correct? Or is it better to implement this in specific project settings? Maybe I can look into it and create a PR :)

@jraats commented on GitHub (Jun 18, 2018): How do you guys want to implement this? Is a global configuration via the INI file correct? Or is it better to implement this in specific project settings? Maybe I can look into it and create a PR :)
Author
Owner

@lunny commented on GitHub (Jun 19, 2018):

@jraats Please feel free to create a PR. Nobody are working on this now.

@lunny commented on GitHub (Jun 19, 2018): @jraats Please feel free to create a PR. Nobody are working on this now.
Author
Owner

@daviian commented on GitHub (Jun 21, 2018):

Wouldn't it be a better solution to automatically hide large diffs and allow the user to async load that diff manually, like github does? I don't want to bloat the repository settings too much.

@daviian commented on GitHub (Jun 21, 2018): Wouldn't it be a better solution to automatically hide large diffs and allow the user to async load that diff manually, like github does? I don't want to bloat the repository settings too much.
Author
Owner

@jraats commented on GitHub (Jun 22, 2018):

@daviian I agree bloat the repository settings too much is not a great idea!
If I'm not mistaken Github uses https://github.com/github/linguist to "detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs". Gitea already suppresses binary data. I also would like to suppress vendored files in diffs. I think this works by using the "vendor.yml" file. When a file in the PR matches a regex in "vendor.yml" the file is omitted in the PR with the text "diff suppressed".

What do you think about building this functionality in Gitea? Loading vendor.yml in RAM and check if the file matches one of the known regexes. If the regex passes show "diff suppressed" with a link to explicit show the diff.

@jraats commented on GitHub (Jun 22, 2018): @daviian I agree bloat the repository settings too much is not a great idea! If I'm not mistaken Github uses https://github.com/github/linguist to "detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs". Gitea already suppresses binary data. I also would like to suppress vendored files in diffs. I think this works by using the "vendor.yml" file. When a file in the PR matches a regex in "vendor.yml" the file is omitted in the PR with the text "diff suppressed". What do you think about building this functionality in Gitea? Loading vendor.yml in RAM and check if the file matches one of the known regexes. If the regex passes show "diff suppressed" with a link to explicit show the diff.
Author
Owner

@daviian commented on GitHub (Jun 22, 2018):

@jraats Great idea. There's also go port for githubs linguist available - https://godoc.org/github.com/generaltso/linguist. Perhaps we could use that.

@daviian commented on GitHub (Jun 22, 2018): @jraats Great idea. There's also go port for githubs linguist available - https://godoc.org/github.com/generaltso/linguist. Perhaps we could use that.
Author
Owner

@42wim commented on GitHub (May 2, 2020):

I've made an ugly hack for excluding the go vendor 171e795e86
If you put "go" in the repo topic, it'll exclude the vendor completely (a downside is that the filenames aren't visible either).

Unfortunately at the moment I don't have the time to actually make this into something decent.

@42wim commented on GitHub (May 2, 2020): I've made an ugly hack for excluding the go vendor https://github.com/42wim/gitea/commit/171e795e861103b2f10662879f97d9a9d21e58fe If you put "go" in the repo topic, it'll exclude the vendor completely (a downside is that the filenames aren't visible either). Unfortunately at the moment I don't have the time to actually make this into something decent.
Author
Owner

@matheusmb commented on GitHub (Dec 3, 2020):

Any updates on this? I would like to exclude/hide the Jest snapshots from the diff view

@matheusmb commented on GitHub (Dec 3, 2020): Any updates on this? I would like to exclude/hide the Jest snapshots from the diff view
Author
Owner

@mrsdizzie commented on GitHub (Dec 3, 2020):

I will try and put up an initial PR for this soon

@mrsdizzie commented on GitHub (Dec 3, 2020): I will try and put up an initial PR for this soon
Author
Owner

@bilderbuchi commented on GitHub (Oct 29, 2021):

Has this been solved by #16773?

@bilderbuchi commented on GitHub (Oct 29, 2021): Has this been solved by #16773?
Author
Owner

@lafriks commented on GitHub (Nov 2, 2021):

Yes, it is, closing

@lafriks commented on GitHub (Nov 2, 2021): Yes, it is, closing
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1852