Don't automatically calculate diff between two branches in compare view #6504

Open
opened 2025-11-02 06:58:00 -06:00 by GiteaMirror · 13 comments
Owner

Originally created by @sebastian-sauer on GitHub (Dec 11, 2020).

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

Description

When opening the compare-Page (to create a pull request or just compare two branches) the diff is calculated automatically.

If you're now changing one of the branches (head or base) gitea will automatically reload the page and calculate the diff again.
Depending on the amount of changes this may take a while.

Idea or suggestion would be to introduce a new "Calculate changes" button that triggers a page reload and thus prevents useless diff calculations on wrong selection of a branch or when you need to change both branch values.

In order to not break any existing workflows i'd suggust to calculate the diff when opening the page with two branches selected directly and just enable the calculate changes button when a branch is changed.

I did a first working prototype - please see attached screenshots.

Should I open a pull request for this or do you think this isn't a good idea?

Screenshots

Initial layout of the page (when opened with two branches the diff is displayed)
image

After a branch is changed the diff will be removed and just a short hint is displayed:
image

Originally created by @sebastian-sauer on GitHub (Dec 11, 2020). <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.3 - Git version: n/a - Operating system: n/a - Database (use `[x]`): - [x ] PostgreSQL - [x ] MySQL - [x ] MSSQL - [x ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - Log gist: ## Description When opening the compare-Page (to create a pull request or just compare two branches) the diff is calculated automatically. If you're now changing one of the branches (head or base) gitea will automatically reload the page and calculate the diff again. Depending on the amount of changes this may take a while. Idea or suggestion would be to introduce a new "Calculate changes" button that triggers a page reload and thus prevents useless diff calculations on wrong selection of a branch or when you need to change both branch values. In order to not break any existing workflows i'd suggust to calculate the diff when opening the page with two branches selected directly and just enable the calculate changes button when a branch is changed. I did a first working prototype - please see attached screenshots. Should I open a pull request for this or do you think this isn't a good idea? ## Screenshots Initial layout of the page (when opened with two branches the diff is displayed) ![image](https://user-images.githubusercontent.com/1135157/101941215-f6db8d80-3be7-11eb-94c6-45dd29dd4933.png) After a branch is changed the diff will be removed and just a short hint is displayed: ![image](https://user-images.githubusercontent.com/1135157/101941276-0955c700-3be8-11eb-885b-0fe96c62d9c1.png) <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/proposaltopic/ui labels 2025-11-02 06:58:00 -06:00
Author
Owner

@a1012112796 commented on GitHub (Dec 12, 2020):

Hmm, maybe it's better to lazy load diff views like gh. which means user can click Create pull request button without waiting diff views loading.
/cc @silverwind @CirnoT

@a1012112796 commented on GitHub (Dec 12, 2020): Hmm, maybe it's better to lazy load diff views like gh. which means user can click ``Create pull request`` button without waiting diff views loading. /cc @silverwind @CirnoT
Author
Owner

@CirnoT commented on GitHub (Dec 12, 2020):

I believe lazy loading would be the only acceptable solution here, this is huge part of UI and hiding it behind user-interacatable button is something I'd rather not do.

@CirnoT commented on GitHub (Dec 12, 2020): I believe lazy loading would be the only acceptable solution here, this is huge part of UI and hiding it behind user-interacatable button is something I'd rather not do.
Author
Owner

@sebastian-sauer commented on GitHub (Dec 12, 2020):

Loading the diff lazy sounds like a good alternative.

Maybe the manual diff calculation could reduce some server loads but the lazy loading feels more like the gh ui approach.

@sebastian-sauer commented on GitHub (Dec 12, 2020): Loading the diff lazy sounds like a good alternative. Maybe the manual diff calculation could reduce some server loads but the lazy loading feels more like the gh ui approach.
Author
Owner

@jpraet commented on GitHub (May 31, 2021):

This current automatic diff calculation is painful when you want to create a PR that does not target the master branch, e.g. for a backport to a release branch. A huge diff is calculated against the master branch first. And the "merge into" dropdown seems unresponsive until the page has completely finished loading.

@jpraet commented on GitHub (May 31, 2021): This current automatic diff calculation is painful when you want to create a PR that does not target the master branch, e.g. for a backport to a release branch. A huge diff is calculated against the master branch first. And the "merge into" dropdown seems unresponsive until the page has completely finished loading.
Author
Owner

@zeripath commented on GitHub (Aug 26, 2021):

This current automatic diff calculation is painful when you want to create a PR that does not target the master branch, e.g. for a backport to a release branch. A huge diff is calculated against the master branch first. And the "merge into" dropdown seems unresponsive until the page has completely finished loading.

#16775 will stop this.

@zeripath commented on GitHub (Aug 26, 2021): > This current automatic diff calculation is painful when you want to create a PR that does not target the master branch, e.g. for a backport to a release branch. A huge diff is calculated against the master branch first. And the "merge into" dropdown seems unresponsive until the page has completely finished loading. #16775 will stop this.
Author
Owner

@MaxWaldorf commented on GitHub (May 30, 2022):

Can anyone tell me if this is still in the roadmap or even implemented?

We are currently having issues because of the heavy quantity or diff in our repo...
Is there something we could do to reduce the wait time?

Cheers

@MaxWaldorf commented on GitHub (May 30, 2022): Can anyone tell me if this is still in the roadmap or even implemented? We are currently having issues because of the heavy quantity or diff in our repo... Is there something we could do to reduce the wait time? Cheers
Author
Owner

@MaxWaldorf commented on GitHub (May 30, 2022):

@sebastian-sauer

Did you do anything on your side in the end?

@MaxWaldorf commented on GitHub (May 30, 2022): @sebastian-sauer Did you do anything on your side in the end?
Author
Owner

@MaxWaldorf commented on GitHub (Jul 25, 2022):

@jpraet
Sorry to bug you but any idea if this will make it to any of the future releases?
Large repos are still suffering from that and I don't see any way to improve that...

Cheers

@MaxWaldorf commented on GitHub (Jul 25, 2022): @jpraet Sorry to bug you but any idea if this will make it to any of the future releases? Large repos are still suffering from that and I don't see any way to improve that... Cheers
Author
Owner

@jpraet commented on GitHub (Jul 26, 2022):

In gitea 1.16 it eagerly loads the first MAX_GIT_DIFF_FILES (configurable in app.ini, defaults to 100), and has a "Show More" button to load the next 100 files. You could reduce the value of this parameter in your configuration.

@jpraet commented on GitHub (Jul 26, 2022): In gitea 1.16 it eagerly loads the first MAX_GIT_DIFF_FILES (configurable in app.ini, defaults to 100), and has a "Show More" button to load the next 100 files. You could reduce the value of this parameter in your configuration.
Author
Owner

@MaxWaldorf commented on GitHub (Jul 26, 2022):

Thank you!

Will try that...

@MaxWaldorf commented on GitHub (Jul 26, 2022): Thank you! Will try that...
Author
Owner

@MaxWaldorf commented on GitHub (Jul 26, 2022):

@jpraet
Well actually when you create a PR it loads all commit diff which is the longest part...
Don't think this parameter can be changed (not seeing anything in the cheat sheet)

@MaxWaldorf commented on GitHub (Jul 26, 2022): @jpraet Well actually when you create a PR it loads all commit diff which is the longest part... Don't think this parameter can be changed (not seeing anything in the cheat sheet)
Author
Owner

@hramrach commented on GitHub (Nov 1, 2023):

Sounds like #6900

@hramrach commented on GitHub (Nov 1, 2023): Sounds like #6900
Author
Owner

@lunny commented on GitHub (Nov 22, 2024):

We can split this configuration into two, one is for comparison, and the other is for pull request files. So that users could reduce the parameters to make compare faster in the first time load.

[git]
;MAX_GIT_DIFF_LINES = 1000
;;
;; Max number of allowed characters in a line in diff view
;MAX_GIT_DIFF_LINE_CHARACTERS = 5000
;;
;; Max number of files shown in diff view
;MAX_GIT_DIFF_FILES = 100
@lunny commented on GitHub (Nov 22, 2024): We can split this configuration into two, one is for comparison, and the other is for pull request files. So that users could reduce the parameters to make compare faster in the first time load. ```ini [git] ;MAX_GIT_DIFF_LINES = 1000 ;; ;; Max number of allowed characters in a line in diff view ;MAX_GIT_DIFF_LINE_CHARACTERS = 5000 ;; ;; Max number of files shown in diff view ;MAX_GIT_DIFF_FILES = 100 ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6504