This commit is contained in:
Lunny Xiao 2024-05-05 23:25:22 +03:00 committed by GitHub
commit d39a778844
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
42 changed files with 96 additions and 9 deletions

View File

@ -45,3 +45,15 @@
is_deleted: false
deleted_by_id: 0
deleted_unix: 0
-
id: 5
repo_id: 62
name: 'master'
commit_id: '883ede87f3768c0b2679d5d95af3cc7a9ac2457b'
commit_message: 'add favicon.png'
commit_time: 1710055656
pusher_id: 1
is_deleted: false
deleted_by_id: 0
deleted_unix: 0

View File

@ -1768,3 +1768,34 @@
size: 0
is_fsck_enabled: true
close_issues_via_commit_in_any_branch: false
-
id: 62
owner_id: 41
owner_name: org41
lower_name: repo62
name: repo62
default_branch: master
num_watches: 0
num_stars: 0
num_forks: 0
num_issues: 0
num_closed_issues: 0
num_pulls: 1
num_closed_pulls: 0
num_milestones: 0
num_closed_milestones: 0
num_projects: 0
num_closed_projects: 0
is_private: false
is_empty: false
is_archived: false
is_mirror: false
status: 0
is_fork: true
fork_id: 1
is_template: false
template_id: 0
size: 0
is_fsck_enabled: true
close_issues_via_commit_in_any_branch: false

View File

@ -344,7 +344,7 @@ func Diff(ctx *context.Context) {
return
}
}
setCompareContext(ctx, parentCommit, commit, userName, repoName)
setCompareContext(ctx, parentCommit, commit, userName, repoName, userName, repoName)
ctx.Data["Title"] = commit.Summary() + " · " + base.ShortSha(commitID)
ctx.Data["Commit"] = commit
ctx.Data["Diff"] = diff

View File

@ -48,7 +48,7 @@ const (
)
// setCompareContext sets context data.
func setCompareContext(ctx *context.Context, before, head *git.Commit, headOwner, headName string) {
func setCompareContext(ctx *context.Context, before, head *git.Commit, beforeOwner, beforeName, headOwner, headName string) {
ctx.Data["BeforeCommit"] = before
ctx.Data["HeadCommit"] = head
@ -79,7 +79,7 @@ func setCompareContext(ctx *context.Context, before, head *git.Commit, headOwner
return st
}
setPathsCompareContext(ctx, before, head, headOwner, headName)
setPathsCompareContext(ctx, before, head, beforeOwner, beforeName, headOwner, headName)
setImageCompareContext(ctx)
setCsvCompareContext(ctx)
}
@ -95,12 +95,12 @@ func RawCommitURL(owner, name string, commit *git.Commit) string {
}
// setPathsCompareContext sets context data for source and raw paths
func setPathsCompareContext(ctx *context.Context, base, head *git.Commit, headOwner, headName string) {
func setPathsCompareContext(ctx *context.Context, before, head *git.Commit, beforeOwner, beforeName, headOwner, headName string) {
ctx.Data["SourcePath"] = SourceCommitURL(headOwner, headName, head)
ctx.Data["RawPath"] = RawCommitURL(headOwner, headName, head)
if base != nil {
ctx.Data["BeforeSourcePath"] = SourceCommitURL(headOwner, headName, base)
ctx.Data["BeforeRawPath"] = RawCommitURL(headOwner, headName, base)
if before != nil {
ctx.Data["BeforeSourcePath"] = SourceCommitURL(beforeOwner, beforeName, before)
ctx.Data["BeforeRawPath"] = RawCommitURL(beforeOwner, beforeName, before)
}
}
@ -674,7 +674,7 @@ func PrepareCompareDiff(
ctx.Data["Username"] = ci.HeadUser.Name
ctx.Data["Reponame"] = ci.HeadRepo.Name
setCompareContext(ctx, beforeCommit, headCommit, ci.HeadUser.Name, repo.Name)
setCompareContext(ctx, beforeCommit, headCommit, repo.OwnerName, repo.Name, ci.HeadUser.Name, ci.HeadRepo.Name)
return false
}

View File

@ -806,7 +806,12 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
}
}
setCompareContext(ctx, baseCommit, commit, ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
if err := pull.LoadHeadRepo(ctx); err != nil {
ctx.ServerError("LoadHeadRepo", err)
return
}
setCompareContext(ctx, baseCommit, commit, ctx.Repo.Repository.OwnerName, ctx.Repo.Repository.Name, pull.HeadRepo.OwnerName, pull.HeadRepo.Name)
assigneeUsers, err := repo_model.GetRepoAssignees(ctx, ctx.Repo.Repository)
if err != nil {

View File

@ -0,0 +1 @@
ref: refs/heads/master

View File

@ -0,0 +1,10 @@
[core]
repositoryformatversion = 0
filemode = true
bare = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = /Users/lunny/data/Projects/gitea/gitea/tests/gitea-repositories-meta/org41/../user2/repo1.git
fetch = +refs/*:refs/*
mirror = true

View File

@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@ -0,0 +1,4 @@
x<01><>QJÅ0EýÎ*f<>¤I@DÁ‡_ú!n`šL^mòhSîÞ ®ÀÏ÷^Î e]ç
½3wu<13>nˆzr,²Ö]ò.îýÀCçƒÎ$uåMrëÒèÑ
1zaÑI\’„„Îê 㘺<10>(>êT6xŸÃ¼­¹áéò‡Oײ|¯u9~l"Öi$cîÑ ªðkZ[ëÿêSö
S¹ÁÇùùåí¼C;Ûä¼òEv¸M!•#G˜30ìǘÊÒêy³]

View File

@ -0,0 +1,2 @@
xe<>±NÄ0D©#åæŽ4
JÄAÅ5”Ž³—,—xÑzsVþ<56>5„DåÑØ»ž7ý,=®®o.áEå<45>¢áq5J=éˆý<CB86>È rÄ=>4§ú O!óŠý<C5A0>ã´ðÐ6ms˜8ƒ¾&\Ea¾tÍT´I¢z”‰Ô…! ¢dso@aÚ&ÌK5üB)r4”Q¦`YèLÚ¯²b <>¾o`Ûaä3¹@(<C5A0>ÒeýÔ­5 ô<>ÂH—\sÔHÿ9Ÿ9Rª3)Îë@ŽSùã_"§4sE0”Rºñ§¤.U|/€m¦Û¿]U÷Ì

View File

@ -0,0 +1,7 @@
# pack-refs with: peeled fully-peeled sorted
65f1bf27bc3bf70f64657658635e66094edbcb4d refs/heads/master
3fa2f829675543ecfc16b2891aebe8bf0608a8f4 refs/notes/commits
4a357436d925b5c974181ff12a994538ddc5a269 refs/pull/2/head
5f22f7d0d95d614d25a5b68592adb345a4b5c7fd refs/pull/3/head
62fb502a7172d4453f0322a2cc85bddffa57f07a refs/pull/5/head
65f1bf27bc3bf70f64657658635e66094edbcb4d refs/tags/v1.1

View File

@ -0,0 +1 @@
883ede87f3768c0b2679d5d95af3cc7a9ac2457b

View File

@ -117,4 +117,10 @@ func TestCompareBranches(t *testing.T) {
diffChanges = []string{"test.txt"}
inspectCompare(t, htmlDoc, diffCount, diffChanges)
req = NewRequest(t, "GET", "/user2/repo1/compare/master...org41/repo62:master")
resp = session.MakeRequest(t, req, http.StatusOK)
htmlDoc = NewHTMLParser(t, resp.Body)
h, _ := htmlDoc.doc.Html()
fmt.Println(h)
}