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

Update code.gitea.io/git #450

Merged
merged 1 commit into from
Dec 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update code.gitea.io/git
  • Loading branch information
lunny committed Dec 22, 2016
commit 5ace5d3527d70633320fa7f91cbf053a0ccbf64e
2 changes: 1 addition & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func handleUpdateTask(uuid string, user, repoUser *models.User, reponame string,

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

resp, err := httplib.Head(reqURL).SetTLSClientConfig(&tls.Config{
Expand Down
4 changes: 2 additions & 2 deletions models/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,12 @@ func CommitRepoAction(opts CommitRepoActionOptions) error {
isNewBranch := false
opType := ActionCommitRepo
// Check it's tag push or branch.
if strings.HasPrefix(opts.RefFullName, git.TAG_PREFIX) {
if strings.HasPrefix(opts.RefFullName, git.TagPrefix) {
opType = ActionPushTag
opts.Commits = &PushCommits{}
} else {
// if not the first commit, set the compare URL.
if opts.OldCommitID == git.EMPTY_SHA {
if opts.OldCommitID == git.EmptySHA {
isNewBranch = true
} else {
opts.Commits.CompareURL = repo.ComposeCompareURL(opts.OldCommitID, opts.NewCommitID)
Expand Down
2 changes: 1 addition & 1 deletion models/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
l.PushFront(mergeCommit)

p := &api.PushPayload{
Ref: git.BRANCH_PREFIX + pr.BaseBranch,
Ref: git.BranchPrefix + pr.BaseBranch,
Before: pr.MergeBase,
After: pr.MergedCommitID,
CompareURL: setting.AppURL + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID),
Expand Down
8 changes: 4 additions & 4 deletions models/repo_editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
}
oldCommitID := opts.LastCommitID
if opts.NewBranch != opts.OldBranch {
oldCommitID = git.EMPTY_SHA
oldCommitID = git.EmptySHA
}
if err := CommitRepoAction(CommitRepoActionOptions{
PusherName: doer.Name,
RepoOwnerID: repo.MustOwner().ID,
RepoName: repo.Name,
RefFullName: git.BRANCH_PREFIX + opts.NewBranch,
RefFullName: git.BranchPrefix + opts.NewBranch,
OldCommitID: oldCommitID,
NewCommitID: commit.ID.String(),
Commits: pushCommits,
Expand Down Expand Up @@ -297,7 +297,7 @@ func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (
PusherName: doer.Name,
RepoOwnerID: repo.MustOwner().ID,
RepoName: repo.Name,
RefFullName: git.BRANCH_PREFIX + opts.NewBranch,
RefFullName: git.BranchPrefix + opts.NewBranch,
OldCommitID: opts.LastCommitID,
NewCommitID: commit.ID.String(),
Commits: pushCommits,
Expand Down Expand Up @@ -533,7 +533,7 @@ func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions)
PusherName: doer.Name,
RepoOwnerID: repo.MustOwner().ID,
RepoName: repo.Name,
RefFullName: git.BRANCH_PREFIX + opts.NewBranch,
RefFullName: git.BranchPrefix + opts.NewBranch,
OldCommitID: opts.LastCommitID,
NewCommitID: commit.ID.String(),
Commits: pushCommits,
Expand Down
8 changes: 4 additions & 4 deletions models/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ type PushUpdateOptions struct {
// PushUpdate must be called for any push actions in order to
// generates necessary push action history feeds.
func PushUpdate(opts PushUpdateOptions) (err error) {
isNewRef := opts.OldCommitID == git.EMPTY_SHA
isDelRef := opts.NewCommitID == git.EMPTY_SHA
isNewRef := opts.OldCommitID == git.EmptySHA
isDelRef := opts.NewCommitID == git.EmptySHA
if isNewRef && isDelRef {
return fmt.Errorf("Old and new revisions are both %s", git.EMPTY_SHA)
return fmt.Errorf("Old and new revisions are both %s", git.EmptySHA)
}

repoPath := RepoPath(opts.RepoUserName, opts.RepoName)
Expand Down Expand Up @@ -127,7 +127,7 @@ func PushUpdate(opts PushUpdateOptions) (err error) {
}

// Push tags.
if strings.HasPrefix(opts.RefFullName, git.TAG_PREFIX) {
if strings.HasPrefix(opts.RefFullName, git.TagPrefix) {
if err := CommitRepoAction(CommitRepoActionOptions{
PusherName: opts.PusherName,
RepoOwnerID: owner.ID,
Expand Down
479 changes: 251 additions & 228 deletions modules/bindata/bindata.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion routers/repo/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func HTTP(ctx *context.Context) {
RepoUserName: username,
RepoName: reponame,
}); err == nil {
go models.AddTestPullRequestTask(authUser, repo.ID, strings.TrimPrefix(refFullName, git.BRANCH_PREFIX), true)
go models.AddTestPullRequestTask(authUser, repo.ID, strings.TrimPrefix(refFullName, git.BranchPrefix), true)
}

}
Expand Down
4 changes: 2 additions & 2 deletions routers/repo/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func TestWebhook(ctx *context.Context) {
if commit == nil {
ghost := models.NewGhostUser()
commit = &git.Commit{
ID: git.MustIDFromString(git.EMPTY_SHA),
ID: git.MustIDFromString(git.EmptySHA),
Author: ghost.NewGitSig(),
Committer: ghost.NewGitSig(),
CommitMessage: "This is a fake commit",
Expand All @@ -370,7 +370,7 @@ func TestWebhook(ctx *context.Context) {

apiUser := ctx.User.APIFormat()
p := &api.PushPayload{
Ref: git.BRANCH_PREFIX + ctx.Repo.Repository.DefaultBranch,
Ref: git.BranchPrefix + ctx.Repo.Repository.DefaultBranch,
Before: commit.ID.String(),
After: commit.ID.String(),
Commits: []*api.PayloadCommit{
Expand Down
4 changes: 2 additions & 2 deletions routers/repo/wiki.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, str
}
pages := make([]PageMeta, 0, len(entries))
for i := range entries {
if entries[i].Type == git.OBJECT_BLOB && strings.HasSuffix(entries[i].Name(), ".md") {
if entries[i].Type == git.ObjectBlob && strings.HasSuffix(entries[i].Name(), ".md") {
name := strings.TrimSuffix(entries[i].Name(), ".md")
pages = append(pages, PageMeta{
Name: name,
Expand Down Expand Up @@ -171,7 +171,7 @@ func WikiPages(ctx *context.Context) {
}
pages := make([]PageMeta, 0, len(entries))
for i := range entries {
if entries[i].Type == git.OBJECT_BLOB && strings.HasSuffix(entries[i].Name(), ".md") {
if entries[i].Type == git.ObjectBlob && strings.HasSuffix(entries[i].Name(), ".md") {
c, err := wikiRepo.GetCommitByPath(entries[i].Name())
if err != nil {
ctx.Handle(500, "GetCommit", err)
Expand Down
136 changes: 30 additions & 106 deletions vendor/code.gitea.io/git/CONTRIBUTING.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions vendor/code.gitea.io/git/CONTRIBUTORS

This file was deleted.

6 changes: 4 additions & 2 deletions vendor/code.gitea.io/git/MAINTAINERS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading