Browse Source

Fix typos in models/ (#576)

Ethan Koenig 3 years ago
parent
commit
1207bda94b

+ 1 - 1
models/access.go

@@ -163,7 +163,7 @@ func maxAccessMode(modes ...AccessMode) AccessMode {
163 163
 	return max
164 164
 }
165 165
 
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?
167 167
 func (repo *Repository) refreshAccesses(e Engine, accessMap map[int64]AccessMode) (err error) {
168 168
 	minMode := AccessModeRead
169 169
 	if !repo.IsPrivate {

+ 2 - 2
models/action.go

@@ -145,7 +145,7 @@ func (a *Action) GetRepoPath() string {
145 145
 }
146 146
 
147 147
 // 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.
149 149
 func (a *Action) ShortRepoPath() string {
150 150
 	return path.Join(a.ShortRepoUserName(), a.ShortRepoName())
151 151
 }
@@ -418,7 +418,7 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
418 418
 			}
419 419
 		}
420 420
 
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.
422 422
 		for _, ref := range issueReopenKeywordsPat.FindAllString(c.Message, -1) {
423 423
 			ref = ref[strings.IndexByte(ref, byte(' '))+1:]
424 424
 			ref = strings.TrimRightFunc(ref, issueIndexTrimRight)

+ 2 - 2
models/error.go

@@ -583,7 +583,7 @@ type ErrPullRequestNotExist struct {
583 583
 	IssueID    int64
584 584
 	HeadRepoID int64
585 585
 	BaseRepoID int64
586
-	HeadBarcnh string
586
+	HeadBranch string
587 587
 	BaseBranch string
588 588
 }
589 589
 
@@ -595,7 +595,7 @@ func IsErrPullRequestNotExist(err error) bool {
595 595
 
596 596
 func (err ErrPullRequestNotExist) Error() string {
597 597
 	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)
599 599
 }
600 600
 
601 601
 // ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error

+ 8 - 8
models/git_diff.go

@@ -78,7 +78,7 @@ var (
78 78
 func diffToHTML(diffs []diffmatchpatch.Diff, lineType DiffLineType) template.HTML {
79 79
 	buf := bytes.NewBuffer(nil)
80 80
 
81
-	// Reproduce signs which are cutted for inline diff before.
81
+	// Reproduce signs which are cut for inline diff before.
82 82
 	switch lineType {
83 83
 	case DiffLineAdd:
84 84
 		buf.WriteByte('+')
@@ -234,7 +234,7 @@ const cmdDiffHead = "diff --git "
234 234
 // ParsePatch builds a Diff object from a io.Reader and some
235 235
 // parameters.
236 236
 // 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) {
238 238
 	var (
239 239
 		diff = &Diff{Files: make([]*DiffFile, 0)}
240 240
 
@@ -295,8 +295,8 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*
295 295
 		curFileLinesCount++
296 296
 		lineCount++
297 297
 
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 {
300 300
 			curFile.IsIncomplete = true
301 301
 		}
302 302
 
@@ -447,7 +447,7 @@ func ParsePatch(maxLines, maxLineCharacteres, maxFiles int, reader io.Reader) (*
447 447
 // GetDiffRange builds a Diff between two commits of a repository.
448 448
 // passing the empty string as beforeCommitID returns a diff from the
449 449
 // 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) {
451 451
 	gitRepo, err := git.OpenRepository(repoPath)
452 452
 	if err != nil {
453 453
 		return nil, err
@@ -486,7 +486,7 @@ func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxL
486 486
 	pid := process.Add(fmt.Sprintf("GetDiffRange [repo_path: %s]", repoPath), cmd)
487 487
 	defer process.Remove(pid)
488 488
 
489
-	diff, err := ParsePatch(maxLines, maxLineCharacteres, maxFiles, stdout)
489
+	diff, err := ParsePatch(maxLines, maxLineCharacters, maxFiles, stdout)
490 490
 	if err != nil {
491 491
 		return nil, fmt.Errorf("ParsePatch: %v", err)
492 492
 	}
@@ -554,6 +554,6 @@ func GetRawDiff(repoPath, commitID string, diffType RawDiffType, writer io.Write
554 554
 }
555 555
 
556 556
 // 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)
559 559
 }

+ 7 - 7
models/graph.go

@@ -31,7 +31,7 @@ type GraphItems []GraphItem
31 31
 // GetCommitGraph return a list of commit (GraphItems) from all branches
32 32
 func GetCommitGraph(r *git.Repository) (GraphItems, error) {
33 33
 
34
-	var Commitgraph []GraphItem
34
+	var CommitGraph []GraphItem
35 35
 
36 36
 	format := "DATA:|%d|%H|%ad|%an|%ae|%h|%s"
37 37
 
@@ -47,19 +47,19 @@ func GetCommitGraph(r *git.Repository) (GraphItems, error) {
47 47
 	)
48 48
 	graph, err := graphCmd.RunInDir(r.Path)
49 49
 	if err != nil {
50
-		return Commitgraph, err
50
+		return CommitGraph, err
51 51
 	}
52 52
 
53
-	Commitgraph = make([]GraphItem, 0, 100)
53
+	CommitGraph = make([]GraphItem, 0, 100)
54 54
 	for _, s := range strings.Split(graph, "\n") {
55 55
 		GraphItem, err := graphItemFromString(s, r)
56 56
 		if err != nil {
57
-			return Commitgraph, err
57
+			return CommitGraph, err
58 58
 		}
59
-		Commitgraph = append(Commitgraph, GraphItem)
59
+		CommitGraph = append(CommitGraph, GraphItem)
60 60
 	}
61 61
 
62
-	return Commitgraph, nil
62
+	return CommitGraph, nil
63 63
 }
64 64
 
65 65
 func graphItemFromString(s string, r *git.Repository) (GraphItem, error) {
@@ -102,7 +102,7 @@ func graphItemFromString(s string, r *git.Repository) (GraphItem, error) {
102 102
 		rows[5],
103 103
 		rows[6],
104 104
 		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.
106 106
 	}
107 107
 	return gi, nil
108 108
 }

+ 1 - 1
models/issue_label.go

@@ -259,7 +259,7 @@ func DeleteLabel(repoID, labelID int64) error {
259 259
 // |___/____  >____  >____/  \___  >_______ (____  /___  /\___  >____/
260 260
 //          \/     \/            \/        \/    \/    \/     \/
261 261
 
262
-// IssueLabel represetns an issue-lable relation.
262
+// IssueLabel represents an issue-label relation.
263 263
 type IssueLabel struct {
264 264
 	ID      int64 `xorm:"pk autoincr"`
265 265
 	IssueID int64 `xorm:"UNIQUE(s)"`

+ 1 - 1
models/issue_mail.go

@@ -24,7 +24,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string)
24 24
 		return nil
25 25
 	}
26 26
 
27
-	// Mail wahtcers.
27
+	// Mail watchers.
28 28
 	watchers, err := GetWatchers(issue.RepoID)
29 29
 	if err != nil {
30 30
 		return fmt.Errorf("GetWatchers [%d]: %v", issue.RepoID, err)

+ 1 - 1
models/notification.go

@@ -66,7 +66,7 @@ func (n *Notification) BeforeInsert() {
66 66
 	n.UpdatedUnix = nowUnix
67 67
 }
68 68
 
69
-// BeforeUpdate runs while updateing a record
69
+// BeforeUpdate runs while updating a record
70 70
 func (n *Notification) BeforeUpdate() {
71 71
 	var (
72 72
 		now     = time.Now()

+ 8 - 8
models/pull.go

@@ -372,7 +372,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
372 372
 
373 373
 	// TODO: when squash commits, no need to append merge commit.
374 374
 	// 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
376 376
 	// to avoid strange diff commits produced.
377 377
 	mergeCommit, err := baseGitRepo.GetBranchCommit(pr.BaseBranch)
378 378
 	if err != nil {
@@ -419,9 +419,9 @@ func (pr *PullRequest) testPatch() (err error) {
419 419
 		return fmt.Errorf("BaseRepo.PatchPath: %v", err)
420 420
 	}
421 421
 
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.
423 423
 	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)
425 425
 		return nil
426 426
 	}
427 427
 
@@ -573,7 +573,7 @@ func PullRequests(baseRepoID int64, opts *PullRequestsOptions) ([]*PullRequest,
573 573
 	return prs, maxResults, findSession.Find(&prs)
574 574
 }
575 575
 
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
577 577
 // by given head/base and repo/branch.
578 578
 func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error) {
579 579
 	pr := new(PullRequest)
@@ -591,7 +591,7 @@ func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch
591 591
 	return pr, nil
592 592
 }
593 593
 
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
595 595
 // by given head information (repo and branch).
596 596
 func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequest, error) {
597 597
 	prs := make([]*PullRequest, 0, 2)
@@ -602,7 +602,7 @@ func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequ
602 602
 		Find(&prs)
603 603
 }
604 604
 
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
606 606
 // by given base information (repo and branch).
607 607
 func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequest, error) {
608 608
 	prs := make([]*PullRequest, 0, 2)
@@ -885,7 +885,7 @@ func ChangeUsernameInPullRequests(oldUserName, newUserName string) error {
885 885
 	return err
886 886
 }
887 887
 
888
-// checkAndUpdateStatus checks if pull request is possible to levaing checking status,
888
+// checkAndUpdateStatus checks if pull request is possible to leaving checking status,
889 889
 // and set to be either conflict or mergeable.
890 890
 func (pr *PullRequest) checkAndUpdateStatus() {
891 891
 	// Status is not changed to conflict means mergeable.
@@ -893,7 +893,7 @@ func (pr *PullRequest) checkAndUpdateStatus() {
893 893
 		pr.Status = PullRequestStatusMergeable
894 894
 	}
895 895
 
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.
897 897
 	if !pullRequestQueue.Exist(pr.ID) {
898 898
 		if err := pr.UpdateCols("status"); err != nil {
899 899
 			log.Error(4, "Update[%d]: %v", pr.ID, err)

+ 3 - 3
models/repo.go

@@ -259,7 +259,7 @@ func (repo *Repository) AfterSet(colName string, _ xorm.Cell) {
259 259
 
260 260
 // MustOwner always returns a valid *User object to avoid
261 261
 // conceptually impossible error handling.
262
-// It creates a fake object that contains error deftail
262
+// It creates a fake object that contains error details
263 263
 // when error occurs.
264 264
 func (repo *Repository) MustOwner() *User {
265 265
 	return repo.mustOwner(x)
@@ -854,7 +854,7 @@ func getRepoInitFile(tp, name string) ([]byte, error) {
854 854
 }
855 855
 
856 856
 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.
858 858
 	_, stderr, err := process.Exec(
859 859
 		fmt.Sprintf("initRepository(git clone): %s", repoPath), "git", "clone", repoPath, tmpDir)
860 860
 	if err != nil {
@@ -1327,7 +1327,7 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
1327 1327
 			return fmt.Errorf("getOwner: %v", err)
1328 1328
 		}
1329 1329
 		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.
1331 1331
 			if err = repo.recalculateTeamAccesses(e, 0); err != nil {
1332 1332
 				return fmt.Errorf("recalculateTeamAccesses: %v", err)
1333 1333
 			}

+ 1 - 1
models/repo_mirror.go

@@ -247,7 +247,7 @@ func SyncMirrors() {
247 247
 	}
248 248
 }
249 249
 
250
-// InitSyncMirrors initializes a go routine to sync the mirros
250
+// InitSyncMirrors initializes a go routine to sync the mirrors
251 251
 func InitSyncMirrors() {
252 252
 	go SyncMirrors()
253 253
 }

+ 2 - 2
models/ssh_key.go

@@ -354,7 +354,7 @@ func appendAuthorizedKeysToFile(keys ...*PublicKey) error {
354 354
 	return nil
355 355
 }
356 356
 
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,
358 358
 // it is OK to use same key as deploy key for multiple repositories/users.
359 359
 func checkKeyContent(content string) error {
360 360
 	has, err := x.Get(&PublicKey{
@@ -526,7 +526,7 @@ func DeletePublicKey(doer *User, id int64) (err error) {
526 526
 
527 527
 // RewriteAllPublicKeys removes any authorized key and rewrite all keys from database again.
528 528
 // 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.
530 530
 func RewriteAllPublicKeys() error {
531 531
 	sshOpLocker.Lock()
532 532
 	defer sshOpLocker.Unlock()

+ 3 - 3
models/user.go

@@ -663,7 +663,7 @@ func Users(opts *SearchUserOptions) ([]*User, error) {
663 663
 		Find(&users)
664 664
 }
665 665
 
666
-// get user by erify code
666
+// get user by verify code
667 667
 func getVerifyUser(code string) (user *User) {
668 668
 	if len(code) <= base.TimeLimitCodeLength {
669 669
 		return nil
@@ -1057,7 +1057,7 @@ type UserCommit struct {
1057 1057
 	*git.Commit
1058 1058
 }
1059 1059
 
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.
1061 1061
 func ValidateCommitWithEmail(c *git.Commit) *User {
1062 1062
 	u, err := GetUserByEmail(c.Author.Email)
1063 1063
 	if err != nil {
@@ -1216,7 +1216,7 @@ func FollowUser(userID, followID int64) (err error) {
1216 1216
 	return sess.Commit()
1217 1217
 }
1218 1218
 
1219
-// UnfollowUser unmarks someone be another's follower.
1219
+// UnfollowUser unmarks someone as another's follower.
1220 1220
 func UnfollowUser(userID, followID int64) (err error) {
1221 1221
 	if userID == followID || !IsFollowing(userID, followID) {
1222 1222
 		return nil

+ 2 - 2
models/user_mail.go

@@ -49,8 +49,8 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
49 49
 		}
50 50
 	}
51 51
 
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).
54 54
 	if !isPrimaryFound {
55 55
 		emails = append(emails, &EmailAddress{
56 56
 			Email:       u.Email,

+ 2 - 2
models/webhook_slack.go

@@ -16,7 +16,7 @@ import (
16 16
 	"code.gitea.io/gitea/modules/setting"
17 17
 )
18 18
 
19
-// SlackMeta contains the slack metdata
19
+// SlackMeta contains the slack metadata
20 20
 type SlackMeta struct {
21 21
 	Channel  string `json:"channel"`
22 22
 	Username string `json:"username"`
@@ -75,7 +75,7 @@ func SlackShortTextFormatter(s string) string {
75 75
 	return s
76 76
 }
77 77
 
78
-// SlackLinkFormatter creates a link compatablie with slack
78
+// SlackLinkFormatter creates a link compatible with slack
79 79
 func SlackLinkFormatter(url string, text string) string {
80 80
 	return fmt.Sprintf("<%s|%s>", url, SlackTextFormatter(text))
81 81
 }