-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't automatically delete repository files if they are present #12409
Conversation
Prior to this PR Gitea would delete any repository files if they are present during creation or migration. This can in certain circumstances lead to data-loss and is slightly unpleasant. This PR provides a mechanism for Gitea to adopt repositories on creation and otherwise requires an explicit flag for deletion. PushCreate is slightly different - the create will cause adoption if that is allowed otherwise it will delete the data if that is allowed. Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
How about not give the option to overwrite the exist repository and just returned error? |
OK I've gone one step further - the adopt or overwrite option is only displayed if it is permitted for that user. Otherwise just the error is returned. The site admin can always adopt or overwrite. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
Codecov Report
@@ Coverage Diff @@
## master #12409 +/- ##
==========================================
- Coverage 43.07% 43.02% -0.05%
==========================================
Files 658 658
Lines 72454 72591 +137
==========================================
+ Hits 31211 31234 +23
- Misses 36186 36295 +109
- Partials 5057 5062 +5
Continue to review full report at Codecov.
|
Signed-off-by: Andrew Thornton <art27@cantab.net>
Please resolve conflicts |
swagger lint |
Signed-off-by: Andrew Thornton <art27@cantab.net>
OK Swagger just needs to be run as part of our generate. Why aren't we doing that? |
Signed-off-by: Andrew Thornton <art27@cantab.net>
I'm serious - I don't understand why the swagger generate can't be done on generate. We can ensure that we generate a valid swagger description as part of lint - but AFAICS there is no good reason to have it in master. |
IsPrivate: opts.Private, | ||
IsMirror: opts.Mirror, | ||
Status: models.RepositoryBeingMigrated, | ||
OverwritePreExisting: opts.OverwritePreExisting && (g.doer.IsAdmin || setting.Repository.AllowOverwriteOfUnadoptedRepositories), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why an admin could not follow the setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? This allows Site Admins to explicitly overwrite pre-existing repositories.
I don't like this PR now because I think it makes the process more complicated. Maybe we should add a new feature which is only a button For this PR we can just return the error if the repository folder exists. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
Any UI that involves adopting repositories is going to have to provide the information like:
it's then going to require a UI to search to find repositories to adopt / overwrite. |
You can change them after adopting them. Then you have resued the previous UI and features. And also this will resolve batching |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lunny's suggestion sounds resonable
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Under the context that this is primarily intended to stop unnecessary data loss (adoption/overwriting being a secondary effect of that), I think this PR is great. I think the code it introduces could be used in a later PR to allow for batch adoption of repositories on disk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is nice now :)
Prior to this PR Gitea would delete any repository files if they are
present during creation or migration. This can in certain circumstances
lead to data-loss and is slightly unpleasant.
This PR provides a mechanism for Gitea to adopt repositories on creation
and otherwise requires an explicit flag for deletion.
PushCreate is slightly different - the create will cause adoption if
that is allowed otherwise it will delete the data if that is allowed.
Signed-off-by: Andrew Thornton art27@cantab.net