diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2016-12-22 17:30:52 +0800 |
---|---|---|
committer | Thomas Boerger <thomas@webhippie.de> | 2016-12-22 10:30:52 +0100 |
commit | 47a7529d9655e11471bbe39958222a13854a6133 (patch) | |
tree | 98e597255245e17d39a0062c3977fb8a510cf413 /models | |
parent | 0c5c34d7ddaf31a6d8123dac36b221de61f5ff96 (diff) | |
download | gitea-47a7529d9655e11471bbe39958222a13854a6133.tar.gz gitea-47a7529d9655e11471bbe39958222a13854a6133.zip |
update code.gitea.io/git (#450)
Diffstat (limited to 'models')
-rw-r--r-- | models/action.go | 4 | ||||
-rw-r--r-- | models/pull.go | 2 | ||||
-rw-r--r-- | models/repo_editor.go | 8 | ||||
-rw-r--r-- | models/update.go | 8 |
4 files changed, 11 insertions, 11 deletions
diff --git a/models/action.go b/models/action.go index e9a0fcdd11..e14dc062fe 100644 --- a/models/action.go +++ b/models/action.go @@ -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) diff --git a/models/pull.go b/models/pull.go index 40e40894a9..9aec3596d4 100644 --- a/models/pull.go +++ b/models/pull.go @@ -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), diff --git a/models/repo_editor.go b/models/repo_editor.go index b8bd46bc1d..551200b4e5 100644 --- a/models/repo_editor.go +++ b/models/repo_editor.go @@ -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, @@ -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, @@ -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, diff --git a/models/update.go b/models/update.go index 39d4f7e3b6..690bc6b329 100644 --- a/models/update.go +++ b/models/update.go @@ -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) @@ -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, |