Skip to content

Commit 1dfece2

Browse files
committed
Fix typos in models/
1 parent 09dabe2 commit 1dfece2

15 files changed

+44
-44
lines changed

models/access.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func maxAccessMode(modes ...AccessMode) AccessMode {
163163
return max
164164
}
165165

166-
// FIXME: do corss-comparison so reduce deletions and additions to the minimum?
166+
// FIXME: do cross-comparison so reduce deletions and additions to the minimum?
167167
func (repo *Repository) refreshAccesses(e Engine, accessMap map[int64]AccessMode) (err error) {
168168
minMode := AccessModeRead
169169
if !repo.IsPrivate {

models/action.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (a *Action) GetRepoPath() string {
145145
}
146146

147147
// ShortRepoPath returns the virtual path to the action repository
148-
// trimed to max 20 + 1 + 33 chars.
148+
// trimmed to max 20 + 1 + 33 chars.
149149
func (a *Action) ShortRepoPath() string {
150150
return path.Join(a.ShortRepoUserName(), a.ShortRepoName())
151151
}
@@ -418,7 +418,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
418418
}
419419
}
420420

421-
// It is conflict to have close and reopen at same time, so refsMarkd doesn't need to reinit here.
421+
// It is conflict to have close and reopen at same time, so refsMarked doesn't need to reinit here.
422422
for _, ref := range issueReopenKeywordsPat.FindAllString(c.Message, -1) {
423423
ref = ref[strings.IndexByte(ref, byte(' '))+1:]
424424
ref = strings.TrimRightFunc(ref, issueIndexTrimRight)

models/error.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ type ErrPullRequestNotExist struct {
583583
IssueID int64
584584
HeadRepoID int64
585585
BaseRepoID int64
586-
HeadBarcnh string
586+
HeadBranch string
587587
BaseBranch string
588588
}
589589

@@ -595,7 +595,7 @@ func IsErrPullRequestNotExist(err error) bool {
595595

596596
func (err ErrPullRequestNotExist) Error() string {
597597
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]",
598-
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBarcnh, err.BaseBranch)
598+
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
599599
}
600600

601601
// ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error

models/git_diff.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var (
7878
func diffToHTML(diffs []diffmatchpatch.Diff, lineType DiffLineType) template.HTML {
7979
buf := bytes.NewBuffer(nil)
8080

81-
// Reproduce signs which are cutted for inline diff before.
81+
// Reproduce signs which are cut for inline diff before.
8282
switch lineType {
8383
case DiffLineAdd:
8484
buf.WriteByte('+')
@@ -234,7 +234,7 @@ const cmdDiffHead = "diff --git "
234234
// ParsePatch builds a Diff object from a io.Reader and some
235235
// parameters.
236236
// TODO: move this function to gogits/git-module
237-
func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*Diff, error) {
237+
func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*Diff, error) {
238238
var (
239239
diff = &Diff{Files: make([]*DiffFile, 0)}
240240

@@ -295,8 +295,8 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*
295295
curFileLinesCount++
296296
lineCount++
297297

298-
// Diff data too large, we only show the first about maxlines lines
299-
if curFileLinesCount >= maxLines || len(line) >= maxLineCharacteres {
298+
// Diff data too large, we only show the first about maxLines lines
299+
if curFileLinesCount >= maxLines || len(line) >= maxLineCharacters {
300300
curFile.IsIncomplete = true
301301
}
302302

@@ -447,7 +447,7 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*
447447
// GetDiffRange builds a Diff between two commits of a repository.
448448
// passing the empty string as beforeCommitID returns a diff from the
449449
// parent commit.
450-
func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacteres, maxFiles int) (*Diff, error) {
450+
func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error) {
451451
gitRepo, err := git.OpenRepository(repoPath)
452452
if err != nil {
453453
return nil, err
@@ -486,7 +486,7 @@ func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxL
486486
pid := process.Add(fmt.Sprintf("GetDiffRange [repo_path: %s]", repoPath), cmd)
487487
defer process.Remove(pid)
488488

489-
diff, err := ParsePatch(maxLines, maxLineCharacteres, maxFiles, stdout)
489+
diff, err := ParsePatch(maxLines, maxLineCharacters, maxFiles, stdout)
490490
if err != nil {
491491
return nil, fmt.Errorf("ParsePatch: %v", err)
492492
}
@@ -554,6 +554,6 @@ func GetRawDiff(repoPath, commitID string, diffType RawDiffType, writer io.Write
554554
}
555555

556556
// GetDiffCommit builds a Diff representing the given commitID.
557-
func GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacteres, maxFiles int) (*Diff, error) {
558-
return GetDiffRange(repoPath, "", commitID, maxLines, maxLineCharacteres, maxFiles)
557+
func GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error) {
558+
return GetDiffRange(repoPath, "", commitID, maxLines, maxLineCharacters, maxFiles)
559559
}

models/graph.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type GraphItems []GraphItem
3131
// GetCommitGraph return a list of commit (GraphItems) from all branches
3232
func GetCommitGraph(r *git.Repository) (GraphItems, error) {
3333

34-
var Commitgraph []GraphItem
34+
var CommitGraph []GraphItem
3535

3636
format := "DATA:|%d|%H|%ad|%an|%ae|%h|%s"
3737

@@ -47,19 +47,19 @@ func GetCommitGraph(r *git.Repository) (GraphItems, error) {
4747
)
4848
graph, err := graphCmd.RunInDir(r.Path)
4949
if err != nil {
50-
return Commitgraph, err
50+
return CommitGraph, err
5151
}
5252

53-
Commitgraph = make([]GraphItem, 0, 100)
53+
CommitGraph = make([]GraphItem, 0, 100)
5454
for _, s := range strings.Split(graph, "\n") {
5555
GraphItem, err := graphItemFromString(s, r)
5656
if err != nil {
57-
return Commitgraph, err
57+
return CommitGraph, err
5858
}
59-
Commitgraph = append(Commitgraph, GraphItem)
59+
CommitGraph = append(CommitGraph, GraphItem)
6060
}
6161

62-
return Commitgraph, nil
62+
return CommitGraph, nil
6363
}
6464

6565
func graphItemFromString(s string, r *git.Repository) (GraphItem, error) {
@@ -102,7 +102,7 @@ func graphItemFromString(s string, r *git.Repository) (GraphItem, error) {
102102
rows[5],
103103
rows[6],
104104
rows[7],
105-
len(rows[2]) == 0, // no commits refered to, only relation in current line.
105+
len(rows[2]) == 0, // no commits referred to, only relation in current line.
106106
}
107107
return gi, nil
108108
}

models/issue_label.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func DeleteLabel(repoID, labelID int64) error {
259259
// |___/____ >____ >____/ \___ >_______ (____ /___ /\___ >____/
260260
// \/ \/ \/ \/ \/ \/ \/
261261

262-
// IssueLabel represetns an issue-lable relation.
262+
// IssueLabel represents an issue-label relation.
263263
type IssueLabel struct {
264264
ID int64 `xorm:"pk autoincr"`
265265
IssueID int64 `xorm:"UNIQUE(s)"`

models/issue_mail.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string)
2424
return nil
2525
}
2626

27-
// Mail wahtcers.
27+
// Mail watchers.
2828
watchers, err := GetWatchers(issue.RepoID)
2929
if err != nil {
3030
return fmt.Errorf("GetWatchers [%d]: %v", issue.RepoID, err)

models/notification.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (n *Notification) BeforeInsert() {
6666
n.UpdatedUnix = nowUnix
6767
}
6868

69-
// BeforeUpdate runs while updateing a record
69+
// BeforeUpdate runs while updating a record
7070
func (n *Notification) BeforeUpdate() {
7171
var (
7272
now = time.Now()

models/pull.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
372372

373373
// TODO: when squash commits, no need to append merge commit.
374374
// It is possible that head branch is not fully sync with base branch for merge commits,
375-
// so we need to get latest head commit and append merge commit manully
375+
// so we need to get latest head commit and append merge commit manually
376376
// to avoid strange diff commits produced.
377377
mergeCommit, err := baseGitRepo.GetBranchCommit(pr.BaseBranch)
378378
if err != nil {
@@ -419,9 +419,9 @@ func (pr *PullRequest) testPatch() (err error) {
419419
return fmt.Errorf("BaseRepo.PatchPath: %v", err)
420420
}
421421

422-
// Fast fail if patch does not exist, this assumes data is cruppted.
422+
// Fast fail if patch does not exist, this assumes data is corrupted.
423423
if !com.IsFile(patchPath) {
424-
log.Trace("PullRequest[%d].testPatch: ignored cruppted data", pr.ID)
424+
log.Trace("PullRequest[%d].testPatch: ignored corrupted data", pr.ID)
425425
return nil
426426
}
427427

@@ -573,7 +573,7 @@ func PullRequests(baseRepoID int64, opts *PullRequestsOptions) ([]*PullRequest,
573573
return prs, maxResults, findSession.Find(&prs)
574574
}
575575

576-
// GetUnmergedPullRequest returnss a pull request that is open and has not been merged
576+
// GetUnmergedPullRequest returns a pull request that is open and has not been merged
577577
// by given head/base and repo/branch.
578578
func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error) {
579579
pr := new(PullRequest)
@@ -591,7 +591,7 @@ func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch
591591
return pr, nil
592592
}
593593

594-
// GetUnmergedPullRequestsByHeadInfo returnss all pull requests that are open and has not been merged
594+
// GetUnmergedPullRequestsByHeadInfo returns all pull requests that are open and has not been merged
595595
// by given head information (repo and branch).
596596
func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequest, error) {
597597
prs := make([]*PullRequest, 0, 2)
@@ -602,7 +602,7 @@ func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequ
602602
Find(&prs)
603603
}
604604

605-
// GetUnmergedPullRequestsByBaseInfo returnss all pull requests that are open and has not been merged
605+
// GetUnmergedPullRequestsByBaseInfo returns all pull requests that are open and has not been merged
606606
// by given base information (repo and branch).
607607
func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequest, error) {
608608
prs := make([]*PullRequest, 0, 2)
@@ -885,15 +885,15 @@ func ChangeUsernameInPullRequests(oldUserName, newUserName string) error {
885885
return err
886886
}
887887

888-
// checkAndUpdateStatus checks if pull request is possible to levaing checking status,
888+
// checkAndUpdateStatus checks if pull request is possible to leaving checking status,
889889
// and set to be either conflict or mergeable.
890890
func (pr *PullRequest) checkAndUpdateStatus() {
891891
// Status is not changed to conflict means mergeable.
892892
if pr.Status == PullRequestStatusChecking {
893893
pr.Status = PullRequestStatusMergeable
894894
}
895895

896-
// Make sure there is no waiting test to process before levaing the checking status.
896+
// Make sure there is no waiting test to process before leaving the checking status.
897897
if !pullRequestQueue.Exist(pr.ID) {
898898
if err := pr.UpdateCols("status"); err != nil {
899899
log.Error(4, "Update[%d]: %v", pr.ID, err)

models/repo.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func (repo *Repository) AfterSet(colName string, _ xorm.Cell) {
259259

260260
// MustOwner always returns a valid *User object to avoid
261261
// conceptually impossible error handling.
262-
// It creates a fake object that contains error deftail
262+
// It creates a fake object that contains error details
263263
// when error occurs.
264264
func (repo *Repository) MustOwner() *User {
265265
return repo.mustOwner(x)
@@ -854,7 +854,7 @@ func getRepoInitFile(tp, name string) ([]byte, error) {
854854
}
855855

856856
func prepareRepoCommit(repo *Repository, tmpDir, repoPath string, opts CreateRepoOptions) error {
857-
// Clone to temprory path and do the init commit.
857+
// Clone to temporary path and do the init commit.
858858
_, stderr, err := process.Exec(
859859
fmt.Sprintf("initRepository(git clone): %s", repoPath), "git", "clone", repoPath, tmpDir)
860860
if err != nil {
@@ -1327,7 +1327,7 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
13271327
return fmt.Errorf("getOwner: %v", err)
13281328
}
13291329
if repo.Owner.IsOrganization() {
1330-
// Organization repository need to recalculate access table when visivility is changed.
1330+
// Organization repository need to recalculate access table when visibility is changed.
13311331
if err = repo.recalculateTeamAccesses(e, 0); err != nil {
13321332
return fmt.Errorf("recalculateTeamAccesses: %v", err)
13331333
}

models/repo_mirror.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func SyncMirrors() {
247247
}
248248
}
249249

250-
// InitSyncMirrors initializes a go routine to sync the mirros
250+
// InitSyncMirrors initializes a go routine to sync the mirrors
251251
func InitSyncMirrors() {
252252
go SyncMirrors()
253253
}

models/ssh_key.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ func appendAuthorizedKeysToFile(keys ...*PublicKey) error {
354354
return nil
355355
}
356356

357-
// checkKeyContent onlys checks if key content has been used as public key,
357+
// checkKeyContent only checks if key content has been used as public key,
358358
// it is OK to use same key as deploy key for multiple repositories/users.
359359
func checkKeyContent(content string) error {
360360
has, err := x.Get(&PublicKey{
@@ -526,7 +526,7 @@ func DeletePublicKey(doer *User, id int64) (err error) {
526526

527527
// RewriteAllPublicKeys removes any authorized key and rewrite all keys from database again.
528528
// Note: x.Iterate does not get latest data after insert/delete, so we have to call this function
529-
// outsite any session scope independently.
529+
// outside any session scope independently.
530530
func RewriteAllPublicKeys() error {
531531
sshOpLocker.Lock()
532532
defer sshOpLocker.Unlock()

models/user.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ func Users(opts *SearchUserOptions) ([]*User, error) {
663663
Find(&users)
664664
}
665665

666-
// get user by erify code
666+
// get user by verify code
667667
func getVerifyUser(code string) (user *User) {
668668
if len(code) <= base.TimeLimitCodeLength {
669669
return nil
@@ -1057,7 +1057,7 @@ type UserCommit struct {
10571057
*git.Commit
10581058
}
10591059

1060-
// ValidateCommitWithEmail chceck if author's e-mail of commit is corresponsind to a user.
1060+
// ValidateCommitWithEmail check if author's e-mail of commit is corresponding to a user.
10611061
func ValidateCommitWithEmail(c *git.Commit) *User {
10621062
u, err := GetUserByEmail(c.Author.Email)
10631063
if err != nil {
@@ -1216,7 +1216,7 @@ func FollowUser(userID, followID int64) (err error) {
12161216
return sess.Commit()
12171217
}
12181218

1219-
// UnfollowUser unmarks someone be another's follower.
1219+
// UnfollowUser unmarks someone as another's follower.
12201220
func UnfollowUser(userID, followID int64) (err error) {
12211221
if userID == followID || !IsFollowing(userID, followID) {
12221222
return nil

models/user_mail.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
4949
}
5050
}
5151

52-
// We alway want the primary email address displayed, even if it's not in
53-
// the emailaddress table (yet).
52+
// We always want the primary email address displayed, even if it's not in
53+
// the email address table (yet).
5454
if !isPrimaryFound {
5555
emails = append(emails, &EmailAddress{
5656
Email: u.Email,

models/webhook_slack.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"code.gitea.io/gitea/modules/setting"
1717
)
1818

19-
// SlackMeta contains the slack metdata
19+
// SlackMeta contains the slack metadata
2020
type SlackMeta struct {
2121
Channel string `json:"channel"`
2222
Username string `json:"username"`
@@ -75,7 +75,7 @@ func SlackShortTextFormatter(s string) string {
7575
return s
7676
}
7777

78-
// SlackLinkFormatter creates a link compatablie with slack
78+
// SlackLinkFormatter creates a link compatible with slack
7979
func SlackLinkFormatter(url string, text string) string {
8080
return fmt.Sprintf("<%s|%s>", url, SlackTextFormatter(text))
8181
}

0 commit comments

Comments
 (0)