Fix typos in models/ (#576)
This commit is contained in:
parent
dc3ff9f2ab
commit
1207bda94b
15 changed files with 44 additions and 44 deletions
|
@ -163,7 +163,7 @@ func maxAccessMode(modes ...AccessMode) AccessMode {
|
|||
return max
|
||||
}
|
||||
|
||||
// FIXME: do corss-comparison so reduce deletions and additions to the minimum?
|
||||
// FIXME: do cross-comparison so reduce deletions and additions to the minimum?
|
||||
func (repo *Repository) refreshAccesses(e Engine, accessMap map[int64]AccessMode) (err error) {
|
||||
minMode := AccessModeRead
|
||||
if !repo.IsPrivate {
|
||||
|
|
|
@ -145,7 +145,7 @@ func (a *Action) GetRepoPath() string {
|
|||
}
|
||||
|
||||
// ShortRepoPath returns the virtual path to the action repository
|
||||
// trimed to max 20 + 1 + 33 chars.
|
||||
// trimmed to max 20 + 1 + 33 chars.
|
||||
func (a *Action) ShortRepoPath() string {
|
||||
return path.Join(a.ShortRepoUserName(), a.ShortRepoName())
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
|
|||
}
|
||||
}
|
||||
|
||||
// It is conflict to have close and reopen at same time, so refsMarkd doesn't need to reinit here.
|
||||
// It is conflict to have close and reopen at same time, so refsMarked doesn't need to reinit here.
|
||||
for _, ref := range issueReopenKeywordsPat.FindAllString(c.Message, -1) {
|
||||
ref = ref[strings.IndexByte(ref, byte(' '))+1:]
|
||||
ref = strings.TrimRightFunc(ref, issueIndexTrimRight)
|
||||
|
|
|
@ -583,7 +583,7 @@ type ErrPullRequestNotExist struct {
|
|||
IssueID int64
|
||||
HeadRepoID int64
|
||||
BaseRepoID int64
|
||||
HeadBarcnh string
|
||||
HeadBranch string
|
||||
BaseBranch string
|
||||
}
|
||||
|
||||
|
@ -595,7 +595,7 @@ func IsErrPullRequestNotExist(err error) bool {
|
|||
|
||||
func (err ErrPullRequestNotExist) Error() string {
|
||||
return fmt.Sprintf("pull request does not exist [id: %d, issue_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
|
||||
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBarcnh, err.BaseBranch)
|
||||
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
|
||||
}
|
||||
|
||||
// ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error
|
||||
|
|
|
@ -78,7 +78,7 @@ var (
|
|||
func diffToHTML(diffs []diffmatchpatch.Diff, lineType DiffLineType) template.HTML {
|
||||
buf := bytes.NewBuffer(nil)
|
||||
|
||||
// Reproduce signs which are cutted for inline diff before.
|
||||
// Reproduce signs which are cut for inline diff before.
|
||||
switch lineType {
|
||||
case DiffLineAdd:
|
||||
buf.WriteByte('+')
|
||||
|
@ -234,7 +234,7 @@ const cmdDiffHead = "diff --git "
|
|||
// ParsePatch builds a Diff object from a io.Reader and some
|
||||
// parameters.
|
||||
// TODO: move this function to gogits/git-module
|
||||
func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*Diff, error) {
|
||||
func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*Diff, error) {
|
||||
var (
|
||||
diff = &Diff{Files: make([]*DiffFile, 0)}
|
||||
|
||||
|
@ -295,8 +295,8 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*
|
|||
curFileLinesCount++
|
||||
lineCount++
|
||||
|
||||
// Diff data too large, we only show the first about maxlines lines
|
||||
if curFileLinesCount >= maxLines || len(line) >= maxLineCharacteres {
|
||||
// Diff data too large, we only show the first about maxLines lines
|
||||
if curFileLinesCount >= maxLines || len(line) >= maxLineCharacters {
|
||||
curFile.IsIncomplete = true
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,7 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*
|
|||
// GetDiffRange builds a Diff between two commits of a repository.
|
||||
// passing the empty string as beforeCommitID returns a diff from the
|
||||
// parent commit.
|
||||
func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacteres, maxFiles int) (*Diff, error) {
|
||||
func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error) {
|
||||
gitRepo, err := git.OpenRepository(repoPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -486,7 +486,7 @@ func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxL
|
|||
pid := process.Add(fmt.Sprintf("GetDiffRange [repo_path: %s]", repoPath), cmd)
|
||||
defer process.Remove(pid)
|
||||
|
||||
diff, err := ParsePatch(maxLines, maxLineCharacteres, maxFiles, stdout)
|
||||
diff, err := ParsePatch(maxLines, maxLineCharacters, maxFiles, stdout)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("ParsePatch: %v", err)
|
||||
}
|
||||
|
@ -554,6 +554,6 @@ func GetRawDiff(repoPath, commitID string, diffType RawDiffType, writer io.Write
|
|||
}
|
||||
|
||||
// GetDiffCommit builds a Diff representing the given commitID.
|
||||
func GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacteres, maxFiles int) (*Diff, error) {
|
||||
return GetDiffRange(repoPath, "", commitID, maxLines, maxLineCharacteres, maxFiles)
|
||||
func GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error) {
|
||||
return GetDiffRange(repoPath, "", commitID, maxLines, maxLineCharacters, maxFiles)
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ type GraphItems []GraphItem
|
|||
// GetCommitGraph return a list of commit (GraphItems) from all branches
|
||||
func GetCommitGraph(r *git.Repository) (GraphItems, error) {
|
||||
|
||||
var Commitgraph []GraphItem
|
||||
var CommitGraph []GraphItem
|
||||
|
||||
format := "DATA:|%d|%H|%ad|%an|%ae|%h|%s"
|
||||
|
||||
|
@ -47,19 +47,19 @@ func GetCommitGraph(r *git.Repository) (GraphItems, error) {
|
|||
)
|
||||
graph, err := graphCmd.RunInDir(r.Path)
|
||||
if err != nil {
|
||||
return Commitgraph, err
|
||||
return CommitGraph, err
|
||||
}
|
||||
|
||||
Commitgraph = make([]GraphItem, 0, 100)
|
||||
CommitGraph = make([]GraphItem, 0, 100)
|
||||
for _, s := range strings.Split(graph, "\n") {
|
||||
GraphItem, err := graphItemFromString(s, r)
|
||||
if err != nil {
|
||||
return Commitgraph, err
|
||||
return CommitGraph, err
|
||||
}
|
||||
Commitgraph = append(Commitgraph, GraphItem)
|
||||
CommitGraph = append(CommitGraph, GraphItem)
|
||||
}
|
||||
|
||||
return Commitgraph, nil
|
||||
return CommitGraph, nil
|
||||
}
|
||||
|
||||
func graphItemFromString(s string, r *git.Repository) (GraphItem, error) {
|
||||
|
@ -102,7 +102,7 @@ func graphItemFromString(s string, r *git.Repository) (GraphItem, error) {
|
|||
rows[5],
|
||||
rows[6],
|
||||
rows[7],
|
||||
len(rows[2]) == 0, // no commits refered to, only relation in current line.
|
||||
len(rows[2]) == 0, // no commits referred to, only relation in current line.
|
||||
}
|
||||
return gi, nil
|
||||
}
|
||||
|
|
|
@ -259,7 +259,7 @@ func DeleteLabel(repoID, labelID int64) error {
|
|||
// |___/____ >____ >____/ \___ >_______ (____ /___ /\___ >____/
|
||||
// \/ \/ \/ \/ \/ \/ \/
|
||||
|
||||
// IssueLabel represetns an issue-lable relation.
|
||||
// IssueLabel represents an issue-label relation.
|
||||
type IssueLabel struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IssueID int64 `xorm:"UNIQUE(s)"`
|
||||
|
|
|
@ -24,7 +24,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string)
|
|||
return nil
|
||||
}
|
||||
|
||||
// Mail wahtcers.
|
||||
// Mail watchers.
|
||||
watchers, err := GetWatchers(issue.RepoID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("GetWatchers [%d]: %v", issue.RepoID, err)
|
||||
|
|
|
@ -66,7 +66,7 @@ func (n *Notification) BeforeInsert() {
|
|||
n.UpdatedUnix = nowUnix
|
||||
}
|
||||
|
||||
// BeforeUpdate runs while updateing a record
|
||||
// BeforeUpdate runs while updating a record
|
||||
func (n *Notification) BeforeUpdate() {
|
||||
var (
|
||||
now = time.Now()
|
||||
|
|
|
@ -372,7 +372,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
|
|||
|
||||
// TODO: when squash commits, no need to append merge commit.
|
||||
// It is possible that head branch is not fully sync with base branch for merge commits,
|
||||
// so we need to get latest head commit and append merge commit manully
|
||||
// so we need to get latest head commit and append merge commit manually
|
||||
// to avoid strange diff commits produced.
|
||||
mergeCommit, err := baseGitRepo.GetBranchCommit(pr.BaseBranch)
|
||||
if err != nil {
|
||||
|
@ -419,9 +419,9 @@ func (pr *PullRequest) testPatch() (err error) {
|
|||
return fmt.Errorf("BaseRepo.PatchPath: %v", err)
|
||||
}
|
||||
|
||||
// Fast fail if patch does not exist, this assumes data is cruppted.
|
||||
// Fast fail if patch does not exist, this assumes data is corrupted.
|
||||
if !com.IsFile(patchPath) {
|
||||
log.Trace("PullRequest[%d].testPatch: ignored cruppted data", pr.ID)
|
||||
log.Trace("PullRequest[%d].testPatch: ignored corrupted data", pr.ID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ func PullRequests(baseRepoID int64, opts *PullRequestsOptions) ([]*PullRequest,
|
|||
return prs, maxResults, findSession.Find(&prs)
|
||||
}
|
||||
|
||||
// GetUnmergedPullRequest returnss a pull request that is open and has not been merged
|
||||
// GetUnmergedPullRequest returns a pull request that is open and has not been merged
|
||||
// by given head/base and repo/branch.
|
||||
func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error) {
|
||||
pr := new(PullRequest)
|
||||
|
@ -591,7 +591,7 @@ func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch
|
|||
return pr, nil
|
||||
}
|
||||
|
||||
// GetUnmergedPullRequestsByHeadInfo returnss all pull requests that are open and has not been merged
|
||||
// GetUnmergedPullRequestsByHeadInfo returns all pull requests that are open and has not been merged
|
||||
// by given head information (repo and branch).
|
||||
func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequest, error) {
|
||||
prs := make([]*PullRequest, 0, 2)
|
||||
|
@ -602,7 +602,7 @@ func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequ
|
|||
Find(&prs)
|
||||
}
|
||||
|
||||
// GetUnmergedPullRequestsByBaseInfo returnss all pull requests that are open and has not been merged
|
||||
// GetUnmergedPullRequestsByBaseInfo returns all pull requests that are open and has not been merged
|
||||
// by given base information (repo and branch).
|
||||
func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequest, error) {
|
||||
prs := make([]*PullRequest, 0, 2)
|
||||
|
@ -885,7 +885,7 @@ func ChangeUsernameInPullRequests(oldUserName, newUserName string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// checkAndUpdateStatus checks if pull request is possible to levaing checking status,
|
||||
// checkAndUpdateStatus checks if pull request is possible to leaving checking status,
|
||||
// and set to be either conflict or mergeable.
|
||||
func (pr *PullRequest) checkAndUpdateStatus() {
|
||||
// Status is not changed to conflict means mergeable.
|
||||
|
@ -893,7 +893,7 @@ func (pr *PullRequest) checkAndUpdateStatus() {
|
|||
pr.Status = PullRequestStatusMergeable
|
||||
}
|
||||
|
||||
// Make sure there is no waiting test to process before levaing the checking status.
|
||||
// Make sure there is no waiting test to process before leaving the checking status.
|
||||
if !pullRequestQueue.Exist(pr.ID) {
|
||||
if err := pr.UpdateCols("status"); err != nil {
|
||||
log.Error(4, "Update[%d]: %v", pr.ID, err)
|
||||
|
|
|
@ -259,7 +259,7 @@ func (repo *Repository) AfterSet(colName string, _ xorm.Cell) {
|
|||
|
||||
// MustOwner always returns a valid *User object to avoid
|
||||
// conceptually impossible error handling.
|
||||
// It creates a fake object that contains error deftail
|
||||
// It creates a fake object that contains error details
|
||||
// when error occurs.
|
||||
func (repo *Repository) MustOwner() *User {
|
||||
return repo.mustOwner(x)
|
||||
|
@ -854,7 +854,7 @@ func getRepoInitFile(tp, name string) ([]byte, error) {
|
|||
}
|
||||
|
||||
func prepareRepoCommit(repo *Repository, tmpDir, repoPath string, opts CreateRepoOptions) error {
|
||||
// Clone to temprory path and do the init commit.
|
||||
// Clone to temporary path and do the init commit.
|
||||
_, stderr, err := process.Exec(
|
||||
fmt.Sprintf("initRepository(git clone): %s", repoPath), "git", "clone", repoPath, tmpDir)
|
||||
if err != nil {
|
||||
|
@ -1327,7 +1327,7 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
|
|||
return fmt.Errorf("getOwner: %v", err)
|
||||
}
|
||||
if repo.Owner.IsOrganization() {
|
||||
// Organization repository need to recalculate access table when visivility is changed.
|
||||
// Organization repository need to recalculate access table when visibility is changed.
|
||||
if err = repo.recalculateTeamAccesses(e, 0); err != nil {
|
||||
return fmt.Errorf("recalculateTeamAccesses: %v", err)
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ func SyncMirrors() {
|
|||
}
|
||||
}
|
||||
|
||||
// InitSyncMirrors initializes a go routine to sync the mirros
|
||||
// InitSyncMirrors initializes a go routine to sync the mirrors
|
||||
func InitSyncMirrors() {
|
||||
go SyncMirrors()
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ func appendAuthorizedKeysToFile(keys ...*PublicKey) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// checkKeyContent onlys checks if key content has been used as public key,
|
||||
// checkKeyContent only checks if key content has been used as public key,
|
||||
// it is OK to use same key as deploy key for multiple repositories/users.
|
||||
func checkKeyContent(content string) error {
|
||||
has, err := x.Get(&PublicKey{
|
||||
|
@ -526,7 +526,7 @@ func DeletePublicKey(doer *User, id int64) (err error) {
|
|||
|
||||
// RewriteAllPublicKeys removes any authorized key and rewrite all keys from database again.
|
||||
// Note: x.Iterate does not get latest data after insert/delete, so we have to call this function
|
||||
// outsite any session scope independently.
|
||||
// outside any session scope independently.
|
||||
func RewriteAllPublicKeys() error {
|
||||
sshOpLocker.Lock()
|
||||
defer sshOpLocker.Unlock()
|
||||
|
|
|
@ -663,7 +663,7 @@ func Users(opts *SearchUserOptions) ([]*User, error) {
|
|||
Find(&users)
|
||||
}
|
||||
|
||||
// get user by erify code
|
||||
// get user by verify code
|
||||
func getVerifyUser(code string) (user *User) {
|
||||
if len(code) <= base.TimeLimitCodeLength {
|
||||
return nil
|
||||
|
@ -1057,7 +1057,7 @@ type UserCommit struct {
|
|||
*git.Commit
|
||||
}
|
||||
|
||||
// ValidateCommitWithEmail chceck if author's e-mail of commit is corresponsind to a user.
|
||||
// ValidateCommitWithEmail check if author's e-mail of commit is corresponding to a user.
|
||||
func ValidateCommitWithEmail(c *git.Commit) *User {
|
||||
u, err := GetUserByEmail(c.Author.Email)
|
||||
if err != nil {
|
||||
|
@ -1216,7 +1216,7 @@ func FollowUser(userID, followID int64) (err error) {
|
|||
return sess.Commit()
|
||||
}
|
||||
|
||||
// UnfollowUser unmarks someone be another's follower.
|
||||
// UnfollowUser unmarks someone as another's follower.
|
||||
func UnfollowUser(userID, followID int64) (err error) {
|
||||
if userID == followID || !IsFollowing(userID, followID) {
|
||||
return nil
|
||||
|
|
|
@ -49,8 +49,8 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// We alway want the primary email address displayed, even if it's not in
|
||||
// the emailaddress table (yet).
|
||||
// We always want the primary email address displayed, even if it's not in
|
||||
// the email address table (yet).
|
||||
if !isPrimaryFound {
|
||||
emails = append(emails, &EmailAddress{
|
||||
Email: u.Email,
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/setting"
|
||||
)
|
||||
|
||||
// SlackMeta contains the slack metdata
|
||||
// SlackMeta contains the slack metadata
|
||||
type SlackMeta struct {
|
||||
Channel string `json:"channel"`
|
||||
Username string `json:"username"`
|
||||
|
@ -75,7 +75,7 @@ func SlackShortTextFormatter(s string) string {
|
|||
return s
|
||||
}
|
||||
|
||||
// SlackLinkFormatter creates a link compatablie with slack
|
||||
// SlackLinkFormatter creates a link compatible with slack
|
||||
func SlackLinkFormatter(url string, text string) string {
|
||||
return fmt.Sprintf("<%s|%s>", url, SlackTextFormatter(text))
|
||||
}
|
||||
|
|
Reference in a new issue