aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-05-12 06:52:46 +0100
committerGitHub <noreply@github.com>2020-05-12 08:52:46 +0300
commit0198bbedc193fd1c5733fede11a57b7900cf6c8c (patch)
treec5be4250e0191f3f027a2d82655d56adc7e84c9e /modules/git
parenta4c7ad99e54d0835f759199599a8dcd6f5d7e90e (diff)
downloadgitea-0198bbedc193fd1c5733fede11a57b7900cf6c8c.tar.gz
gitea-0198bbedc193fd1c5733fede11a57b7900cf6c8c.zip
Allow compare page to look up base, head, own-fork, forkbase-of-head (#11327)
* Allow compare page to look up base, head, own-fork, forkbase-of-head Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @guillep2k Signed-off-by: Andrew Thornton <art27@cantab.net> * Update routers/repo/compare.go * as per @guillep2k Signed-off-by: Andrew Thornton <art27@cantab.net> * Rationalise the names a little Signed-off-by: Andrew Thornton <art27@cantab.net> * Rationalise the names a little (2) Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix 500 with fork of fork Signed-off-by: Andrew Thornton <art27@cantab.net> * Prevent 500 on compare different trees Signed-off-by: Andrew Thornton <art27@cantab.net> * dotdotdot is perfectly valid in both usernames and repo names Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure we can set the head and base repos too Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure we can set the head and base repos too (2) Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * only set headRepo == baseRepo if isSameRepo Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/commit.go4
-rw-r--r--modules/git/repo_compare.go1
2 files changed, 0 insertions, 5 deletions
diff --git a/modules/git/commit.go b/modules/git/commit.go
index e65782912f..5e492e27ea 100644
--- a/modules/git/commit.go
+++ b/modules/git/commit.go
@@ -529,10 +529,6 @@ func GetCommitFileStatus(repoPath, commitID string) (*CommitFileStatus, error) {
// GetFullCommitID returns full length (40) of commit ID by given short SHA in a repository.
func GetFullCommitID(repoPath, shortID string) (string, error) {
- if len(shortID) >= 40 {
- return shortID, nil
- }
-
commitID, err := NewCommand("rev-parse", shortID).RunInDir(repoPath)
if err != nil {
if strings.Contains(err.Error(), "exit status 128") {
diff --git a/modules/git/repo_compare.go b/modules/git/repo_compare.go
index 683ac7a7ee..5bc7f9ca5a 100644
--- a/modules/git/repo_compare.go
+++ b/modules/git/repo_compare.go
@@ -89,7 +89,6 @@ func (repo *Repository) GetCompareInfo(basePath, baseBranch, headBranch string)
return nil, err
}
compareInfo.NumFiles = len(strings.Split(stdout, "\n")) - 1
-
return compareInfo, nil
}