aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-10-15 17:05:33 +0100
committerGitHub <noreply@github.com>2021-10-15 17:05:33 +0100
commita889d0cc8c70431d43a9e46a6cf859f7b490aeb3 (patch)
treeaa1f734e2e6442d8f4c41233ac542b40e665a29d /modules
parentbdfd751af88c5bdb70dbdfb4f7f607f6fbf77896 (diff)
downloadgitea-a889d0cc8c70431d43a9e46a6cf859f7b490aeb3.tar.gz
gitea-a889d0cc8c70431d43a9e46a6cf859f7b490aeb3.zip
Add buttons to allow loading of incomplete diffs (#16829)
This PR adds two buttons to the stats and the end of the diffs list to load the (some of) the remaining incomplete diff sections. Contains #16775 Signed-off-by: Andrew Thornton <art27@cantab.net> ## Screenshots ### Show more button at the end of the diff ![Screenshot from 2021-09-04 11-12-37](https://user-images.githubusercontent.com/1824502/132091009-b1f6113e-2c04-4be5-8a04-b8ecea56887b.png) ### Show more button at the end of the diff stats box ![Screenshot from 2021-09-04 11-14-54](https://user-images.githubusercontent.com/1824502/132091063-86da5a6d-6628-4b82-bea9-3655cd9f40f6.png)
Diffstat (limited to 'modules')
-rw-r--r--modules/git/repo_compare.go20
1 files changed, 12 insertions, 8 deletions
diff --git a/modules/git/repo_compare.go b/modules/git/repo_compare.go
index 50e9005511..019c9bc806 100644
--- a/modules/git/repo_compare.go
+++ b/modules/git/repo_compare.go
@@ -46,7 +46,7 @@ func (repo *Repository) GetMergeBase(tmpRemote string, base, head string) (strin
}
// GetCompareInfo generates and returns compare information between base and head branches of repositories.
-func (repo *Repository) GetCompareInfo(basePath, baseBranch, headBranch string, directComparison bool) (_ *CompareInfo, err error) {
+func (repo *Repository) GetCompareInfo(basePath, baseBranch, headBranch string, directComparison, fileOnly bool) (_ *CompareInfo, err error) {
var (
remoteBranch string
tmpRemote string
@@ -87,13 +87,17 @@ func (repo *Repository) GetCompareInfo(basePath, baseBranch, headBranch string,
}
// We have a common base - therefore we know that ... should work
- logs, err := NewCommand("log", baseCommitID+separator+headBranch, prettyLogFormat).RunInDirBytes(repo.Path)
- if err != nil {
- return nil, err
- }
- compareInfo.Commits, err = repo.parsePrettyFormatLogToList(logs)
- if err != nil {
- return nil, fmt.Errorf("parsePrettyFormatLogToList: %v", err)
+ if !fileOnly {
+ logs, err := NewCommand("log", baseCommitID+separator+headBranch, prettyLogFormat).RunInDirBytes(repo.Path)
+ if err != nil {
+ return nil, err
+ }
+ compareInfo.Commits, err = repo.parsePrettyFormatLogToList(logs)
+ if err != nil {
+ return nil, fmt.Errorf("parsePrettyFormatLogToList: %v", err)
+ }
+ } else {
+ compareInfo.Commits = []*Commit{}
}
} else {
compareInfo.Commits = []*Commit{}