Skip to content

Commit a5aae1c

Browse files
committed
Lint models/repo_*
1 parent 27d6685 commit a5aae1c

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

models/repo_collaboration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Collaboration struct {
1616
Mode AccessMode `xorm:"DEFAULT 2 NOT NULL"`
1717
}
1818

19+
// ModeI18nKey returns the collaboration mode I18n Key
1920
func (c *Collaboration) ModeI18nKey() string {
2021
switch c.Mode {
2122
case AccessModeRead:

models/repo_editor.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func discardLocalRepoBranchChanges(localPath, branch string) error {
5050
return nil
5151
}
5252

53+
// DiscardLocalRepoBranchChanges discards the local repository branch changes
5354
func (repo *Repository) DiscardLocalRepoBranchChanges(branch string) error {
5455
return discardLocalRepoBranchChanges(repo.LocalCopyPath(), branch)
5556
}
@@ -66,10 +67,12 @@ func checkoutNewBranch(repoPath, localPath, oldBranch, newBranch string) error {
6667
return nil
6768
}
6869

70+
// CheckoutNewBranch checks out a new branch
6971
func (repo *Repository) CheckoutNewBranch(oldBranch, newBranch string) error {
7072
return checkoutNewBranch(repo.RepoPath(), repo.LocalCopyPath(), oldBranch, newBranch)
7173
}
7274

75+
// UpdateRepoFileOptions holds the repository file update options
7376
type UpdateRepoFileOptions struct {
7477
LastCommitID string
7578
OldBranch string
@@ -223,6 +226,7 @@ func (repo *Repository) GetDiffPreview(branch, treePath, content string) (diff *
223226
// \/ \/ \/ \/ \/ \/
224227
//
225228

229+
// DeleteRepoFileOptions holds the repository delete file options
226230
type DeleteRepoFileOptions struct {
227231
LastCommitID string
228232
OldBranch string
@@ -231,6 +235,7 @@ type DeleteRepoFileOptions struct {
231235
Message string
232236
}
233237

238+
// DeleteRepoFile deletes a repository file
234239
func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (err error) {
235240
repoWorkingPool.CheckIn(com.ToStr(repo.ID))
236241
defer repoWorkingPool.CheckOut(com.ToStr(repo.ID))
@@ -351,6 +356,7 @@ func NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err err
351356
return upload, nil
352357
}
353358

359+
// GetUploadByUUID returns the Upload by UUID
354360
func GetUploadByUUID(uuid string) (*Upload, error) {
355361
upload := &Upload{UUID: uuid}
356362
has, err := x.Get(upload)
@@ -362,6 +368,7 @@ func GetUploadByUUID(uuid string) (*Upload, error) {
362368
return upload, nil
363369
}
364370

371+
// GetUploadsByUUIDs returns multiple uploads by UUIDS
365372
func GetUploadsByUUIDs(uuids []string) ([]*Upload, error) {
366373
if len(uuids) == 0 {
367374
return []*Upload{}, nil
@@ -372,6 +379,7 @@ func GetUploadsByUUIDs(uuids []string) ([]*Upload, error) {
372379
return uploads, x.In("uuid", uuids).Find(&uploads)
373380
}
374381

382+
// DeleteUploads deletes multiple uploads
375383
func DeleteUploads(uploads ...*Upload) (err error) {
376384
if len(uploads) == 0 {
377385
return nil
@@ -407,10 +415,12 @@ func DeleteUploads(uploads ...*Upload) (err error) {
407415
return sess.Commit()
408416
}
409417

418+
// DeleteUpload delete a upload
410419
func DeleteUpload(u *Upload) error {
411420
return DeleteUploads(u)
412421
}
413422

423+
// DeleteUploadByUUID deletes a upload by UUID
414424
func DeleteUploadByUUID(uuid string) error {
415425
upload, err := GetUploadByUUID(uuid)
416426
if err != nil {
@@ -427,6 +437,7 @@ func DeleteUploadByUUID(uuid string) error {
427437
return nil
428438
}
429439

440+
// UploadRepoFileOptions contains the uploaded repository file options
430441
type UploadRepoFileOptions struct {
431442
LastCommitID string
432443
OldBranch string
@@ -436,6 +447,7 @@ type UploadRepoFileOptions struct {
436447
Files []string // In UUID format.
437448
}
438449

450+
// UploadRepoFiles uploads files to a repository
439451
func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions) (err error) {
440452
if len(opts.Files) == 0 {
441453
return nil

0 commit comments

Comments
 (0)