You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zeripath 7a7f56044a
Adopt repositories (#12920)
* Don't automatically delete repository files if they are present

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>

* Update swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix tests and migrate overwrite

Signed-off-by: Andrew Thornton <art27@cantab.net>

* as per @lunny

Only offer to adopt or overwrite if the user can do that.

Allow the site administrator to adopt or overwrite in all
circumstances

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Use setting.Repository.DefaultBranch for the default branch

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Always set setting.Repository.DefaultBranch

Signed-off-by: Andrew Thornton <art27@cantab.net>

* update swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>

* update templates

Signed-off-by: Andrew Thornton <art27@cantab.net>

* ensure repo closed

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Rewrite of adoption as per @6543 and @lunny

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Apply suggestions from code review

* update swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>

* missing not

Signed-off-by: Andrew Thornton <art27@cantab.net>

* add modals and flash reporting

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Make the unadopted page searchable

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Add API

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>

* fix swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Handle empty and non-master branched repositories

Signed-off-by: Andrew Thornton <art27@cantab.net>

* placate lint

Signed-off-by: Andrew Thornton <art27@cantab.net>

* remove commented out code

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
..
pipeline Add basic repository lfs management (#7199) 5 years ago
tests/repos Fix reading git notes from nested trees (#8026) 5 years ago
README.md move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364) 5 years ago
blame.go Ensure BlameReaders close at end of request (#12102) 4 years ago
blame_test.go Ensure BlameReaders close at end of request (#12102) 4 years ago
blob.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
blob_test.go Add Close() method to gogitRepository (#8901) 5 years ago
cache.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
command.go refactor repo_stats to use os.pipe (#11726) 4 years ago
command_test.go Fix nondeterministic behavior (#9341) 5 years ago
commit.go [Vendor] Switch go-version lib (#12719) 4 years ago
commit_archive.go Set context for running CreateArchive in to that of the request (#12555) 4 years ago
commit_info.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
commit_info_test.go Re-attempt to delete temporary upload if the file is locked by another process (#12447) 4 years ago
commit_reader.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
commit_test.go move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364) 5 years ago
diff.go Some refactor on git diff and ignore getting commit information failed on migrating pull request review comments (#9996) 4 years ago
diff_test.go Some refactor on git diff and ignore getting commit information failed on migrating pull request review comments (#9996) 4 years ago
error.go Handle push rejection in branch and upload (#10854) 4 years ago
git.go [Vendor] Switch go-version lib (#12719) 4 years ago
git_test.go Graceful: Xorm, RepoIndexer, Cron and Others (#9282) 5 years ago
hook.go fix typos (#12545) 4 years ago
notes.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
notes_test.go Add Close() method to gogitRepository (#8901) 5 years ago
parse.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
parse_test.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
ref.go move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364) 5 years ago
repo.go Handle push rejection in branch and upload (#10854) 4 years ago
repo_attribute.go [Vendor] Switch go-version lib (#12719) 4 years ago
repo_blame.go Removed unnecessary conversions (#7557) 5 years ago
repo_blob.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
repo_blob_test.go Add Close() method to gogitRepository (#8901) 5 years ago
repo_branch.go Adopt repositories (#12920) 4 years ago
repo_branch_test.go Add Close() method to gogitRepository (#8901) 5 years ago
repo_commit.go [Vendor] Switch go-version lib (#12719) 4 years ago
repo_commit_test.go Add Close() method to gogitRepository (#8901) 5 years ago
repo_commitgraph.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
repo_compare.go Git 2.28 no longer permits diff with ... on unrelated branches (#12364) 4 years ago
repo_compare_test.go Re-attempt to delete temporary upload if the file is locked by another process (#12447) 4 years ago
repo_gpg.go Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631) 5 years ago
repo_hook.go move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364) 5 years ago
repo_index.go Be more strict with git arguments (#7715) 5 years ago
repo_language_stats.go Use enry language type to detect special languages (#11974) 4 years ago
repo_object.go Fixes #7292 - API File Contents bug (#7301) 5 years ago
repo_ref.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
repo_ref_test.go Add Close() method to gogitRepository (#8901) 5 years ago
repo_stats.go refactor repo_stats to use os.pipe (#11726) 4 years ago
repo_stats_test.go Add top author stats to activity page (#9615) 5 years ago
repo_tag.go [Vendor] Switch go-version lib (#12719) 4 years ago
repo_tag_test.go Re-attempt to delete temporary upload if the file is locked by another process (#12447) 4 years ago
repo_test.go Add Close() method to gogitRepository (#8901) 5 years ago
repo_tree.go Add configurable Trust Models (#11712) 4 years ago
sha1.go Fix issue with DiffIndex on initial commit (#11677) 4 years ago
signature.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
submodule.go Compare SSH_DOMAIN when parsing submodule URLs (#12753) 4 years ago
submodule_test.go Compare SSH_DOMAIN when parsing submodule URLs (#12753) 4 years ago
tag.go Fixes #2738 - Adds the /git/tags API endpoint (#7138) 5 years ago
tree.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
tree_blob.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
tree_entry.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
tree_entry_test.go Migrate to go-git/go-git v5.0.0 (#10735) 4 years ago
utils.go Fix ref links in issue overviews for tags (#8742) 4 years ago
utils_test.go Fix ref links in issue overviews for tags (#8742) 4 years ago

README.md

Git Module

This module is merged from https://github.com/go-gitea/git which is a Go module to access Git through shell commands. Now it's a part of gitea's main repository for easier pull request.