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

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

Open
2 tasks
sebastian-sauer opened this issue Dec 11, 2020 · 13 comments
Open
2 tasks
Labels
topic/ui Change the appearance of the Gitea UI type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@sebastian-sauer
Copy link
Contributor

  • 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

sebastian-sauer added a commit to sebastian-sauer/gitea that referenced this issue Dec 11, 2020
Don't automatically reload the compare page on a branch change.
Adds a new calculate changes button to trigger the reload on demand.

go-gitea#13949
@a1012112796
Copy link
Member

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 a1012112796 added type/proposal The new feature has not been accepted yet but needs to be discussed first. topic/ui Change the appearance of the Gitea UI and removed type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Dec 12, 2020
@CirnoT
Copy link
Contributor

CirnoT commented 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.

@sebastian-sauer
Copy link
Contributor Author

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.

@jpraet
Copy link
Member

jpraet commented 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.

@zeripath
Copy link
Contributor

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.

@MaxWaldorf
Copy link

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
Copy link

@sebastian-sauer

Did you do anything on your side in the end?

@MaxWaldorf
Copy link

@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

@jpraet
Copy link
Member

jpraet commented 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.

@MaxWaldorf
Copy link

Thank you!

Will try that...

@MaxWaldorf
Copy link

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

@hramrach
Copy link

hramrach commented Nov 1, 2023

Sounds like #6900

@lunny lunny added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Nov 1, 2023
@lunny
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/ui Change the appearance of the Gitea UI type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

8 participants