Skip to content

Commit 47a7529

Browse files
lunnytboerger
authored andcommitted
update code.gitea.io/git (#450)
1 parent 0c5c34d commit 47a7529

36 files changed

+508
-479
lines changed

cmd/serve.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func handleUpdateTask(uuid string, user, repoUser *models.User, reponame string,
121121

122122
// Ask for running deliver hook and test pull request tasks.
123123
reqURL := setting.LocalURL + repoUser.Name + "/" + reponame + "/tasks/trigger?branch=" +
124-
strings.TrimPrefix(task.RefName, git.BRANCH_PREFIX) + "&secret=" + base.EncodeMD5(repoUser.Salt) + "&pusher=" + com.ToStr(user.ID)
124+
strings.TrimPrefix(task.RefName, git.BranchPrefix) + "&secret=" + base.EncodeMD5(repoUser.Salt) + "&pusher=" + com.ToStr(user.ID)
125125
log.GitLogger.Trace("Trigger task: %s", reqURL)
126126

127127
resp, err := httplib.Head(reqURL).SetTLSClientConfig(&tls.Config{

models/action.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,12 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
494494
isNewBranch := false
495495
opType := ActionCommitRepo
496496
// Check it's tag push or branch.
497-
if strings.HasPrefix(opts.RefFullName, git.TAG_PREFIX) {
497+
if strings.HasPrefix(opts.RefFullName, git.TagPrefix) {
498498
opType = ActionPushTag
499499
opts.Commits = &PushCommits{}
500500
} else {
501501
// if not the first commit, set the compare URL.
502-
if opts.OldCommitID == git.EMPTY_SHA {
502+
if opts.OldCommitID == git.EmptySHA {
503503
isNewBranch = true
504504
} else {
505505
opts.Commits.CompareURL = repo.ComposeCompareURL(opts.OldCommitID, opts.NewCommitID)

models/pull.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
380380
l.PushFront(mergeCommit)
381381

382382
p := &api.PushPayload{
383-
Ref: git.BRANCH_PREFIX + pr.BaseBranch,
383+
Ref: git.BranchPrefix + pr.BaseBranch,
384384
Before: pr.MergeBase,
385385
After: pr.MergedCommitID,
386386
CompareURL: setting.AppURL + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),

models/repo_editor.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
158158
}
159159
oldCommitID := opts.LastCommitID
160160
if opts.NewBranch != opts.OldBranch {
161-
oldCommitID = git.EMPTY_SHA
161+
oldCommitID = git.EmptySHA
162162
}
163163
if err := CommitRepoAction(CommitRepoActionOptions{
164164
PusherName: doer.Name,
165165
RepoOwnerID: repo.MustOwner().ID,
166166
RepoName: repo.Name,
167-
RefFullName: git.BRANCH_PREFIX + opts.NewBranch,
167+
RefFullName: git.BranchPrefix + opts.NewBranch,
168168
OldCommitID: oldCommitID,
169169
NewCommitID: commit.ID.String(),
170170
Commits: pushCommits,
@@ -297,7 +297,7 @@ func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (
297297
PusherName: doer.Name,
298298
RepoOwnerID: repo.MustOwner().ID,
299299
RepoName: repo.Name,
300-
RefFullName: git.BRANCH_PREFIX + opts.NewBranch,
300+
RefFullName: git.BranchPrefix + opts.NewBranch,
301301
OldCommitID: opts.LastCommitID,
302302
NewCommitID: commit.ID.String(),
303303
Commits: pushCommits,
@@ -533,7 +533,7 @@ func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions)
533533
PusherName: doer.Name,
534534
RepoOwnerID: repo.MustOwner().ID,
535535
RepoName: repo.Name,
536-
RefFullName: git.BRANCH_PREFIX + opts.NewBranch,
536+
RefFullName: git.BranchPrefix + opts.NewBranch,
537537
OldCommitID: opts.LastCommitID,
538538
NewCommitID: commit.ID.String(),
539539
Commits: pushCommits,

models/update.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ type PushUpdateOptions struct {
9191
// PushUpdate must be called for any push actions in order to
9292
// generates necessary push action history feeds.
9393
func PushUpdate(opts PushUpdateOptions) (err error) {
94-
isNewRef := opts.OldCommitID == git.EMPTY_SHA
95-
isDelRef := opts.NewCommitID == git.EMPTY_SHA
94+
isNewRef := opts.OldCommitID == git.EmptySHA
95+
isDelRef := opts.NewCommitID == git.EmptySHA
9696
if isNewRef && isDelRef {
97-
return fmt.Errorf("Old and new revisions are both %s", git.EMPTY_SHA)
97+
return fmt.Errorf("Old and new revisions are both %s", git.EmptySHA)
9898
}
9999

100100
repoPath := RepoPath(opts.RepoUserName, opts.RepoName)
@@ -127,7 +127,7 @@ func PushUpdate(opts PushUpdateOptions) (err error) {
127127
}
128128

129129
// Push tags.
130-
if strings.HasPrefix(opts.RefFullName, git.TAG_PREFIX) {
130+
if strings.HasPrefix(opts.RefFullName, git.TagPrefix) {
131131
if err := CommitRepoAction(CommitRepoActionOptions{
132132
PusherName: opts.PusherName,
133133
RepoOwnerID: owner.ID,

modules/bindata/bindata.go

+251-228
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

routers/repo/http.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func HTTP(ctx *context.Context) {
208208
RepoUserName: username,
209209
RepoName: reponame,
210210
}); err == nil {
211-
go models.AddTestPullRequestTask(authUser, repo.ID, strings.TrimPrefix(refFullName, git.BRANCH_PREFIX), true)
211+
go models.AddTestPullRequestTask(authUser, repo.ID, strings.TrimPrefix(refFullName, git.BranchPrefix), true)
212212
}
213213

214214
}

routers/repo/webhook.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ func TestWebhook(ctx *context.Context) {
361361
if commit == nil {
362362
ghost := models.NewGhostUser()
363363
commit = &git.Commit{
364-
ID: git.MustIDFromString(git.EMPTY_SHA),
364+
ID: git.MustIDFromString(git.EmptySHA),
365365
Author: ghost.NewGitSig(),
366366
Committer: ghost.NewGitSig(),
367367
CommitMessage: "This is a fake commit",
@@ -370,7 +370,7 @@ func TestWebhook(ctx *context.Context) {
370370

371371
apiUser := ctx.User.APIFormat()
372372
p := &api.PushPayload{
373-
Ref: git.BRANCH_PREFIX + ctx.Repo.Repository.DefaultBranch,
373+
Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch,
374374
Before: commit.ID.String(),
375375
After: commit.ID.String(),
376376
Commits: []*api.PayloadCommit{

routers/repo/wiki.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, str
6666
}
6767
pages := make([]PageMeta, 0, len(entries))
6868
for i := range entries {
69-
if entries[i].Type == git.OBJECT_BLOB && strings.HasSuffix(entries[i].Name(), ".md") {
69+
if entries[i].Type == git.ObjectBlob && strings.HasSuffix(entries[i].Name(), ".md") {
7070
name := strings.TrimSuffix(entries[i].Name(), ".md")
7171
pages = append(pages, PageMeta{
7272
Name: name,
@@ -171,7 +171,7 @@ func WikiPages(ctx *context.Context) {
171171
}
172172
pages := make([]PageMeta, 0, len(entries))
173173
for i := range entries {
174-
if entries[i].Type == git.OBJECT_BLOB && strings.HasSuffix(entries[i].Name(), ".md") {
174+
if entries[i].Type == git.ObjectBlob && strings.HasSuffix(entries[i].Name(), ".md") {
175175
c, err := wikiRepo.GetCommitByPath(entries[i].Name())
176176
if err != nil {
177177
ctx.Handle(500, "GetCommit", err)

vendor/code.gitea.io/git/CONTRIBUTING.md

+30-106
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/code.gitea.io/git/CONTRIBUTORS

-9
This file was deleted.

vendor/code.gitea.io/git/MAINTAINERS

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)