Skip to content

Commit 3f8e9dc

Browse files
committed
fix
1 parent 301eaf6 commit 3f8e9dc

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

modules/structs/repo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ type EditRepoOption struct {
217217
Archived *bool `json:"archived,omitempty"`
218218
// set to a string like `8h30m0s` to set the mirror interval time
219219
MirrorInterval *string `json:"mirror_interval,omitempty"`
220-
// enable prune - remove obsolete remote-tracking references
220+
// enable prune - remove obsolete remote-tracking references when mirroring
221221
EnablePrune *bool `json:"enable_prune,omitempty"`
222222
}
223223

routers/api/v1/repo/repo.go

+2-9
Original file line numberDiff line numberDiff line change
@@ -1062,16 +1062,9 @@ func updateRepoArchivedState(ctx *context.APIContext, opts api.EditRepoOption) e
10621062
func updateMirror(ctx *context.APIContext, opts api.EditRepoOption) error {
10631063
repo := ctx.Repo.Repository
10641064

1065-
// only update mirror if interval or enable prune are provided
1066-
if opts.MirrorInterval == nil && opts.EnablePrune == nil {
1067-
return nil
1068-
}
1069-
1070-
// these values only make sense if the repo is a mirror
1065+
// skip this update if the repo is not a mirror
10711066
if !repo.IsMirror {
1072-
err := fmt.Errorf("repo is not a mirror, can not change mirror interval")
1073-
ctx.Error(http.StatusUnprocessableEntity, err.Error(), err)
1074-
return err
1067+
return nil
10751068
}
10761069

10771070
// get the mirror from the repo

templates/swagger/v1_json.tmpl

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)