Skip to content
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

Add bundle download for repository #14538

Merged
merged 6 commits into from Aug 24, 2021
Merged

Add bundle download for repository #14538

merged 6 commits into from Aug 24, 2021

Conversation

jolheiser
Copy link
Member

This PR adds another download type for repositories, bundle.

This currently always bundles using --all, since I'd imagine it's almost always more useful to have the entire repo history.

In the future, bundling could be considered for backups since they are standalone repositories, more or less.

One thing that I couldn't seem to shake when writing this, it seems like the bundle file refused to copy correctly unless I closed the file after creation (and subsequently re-opened to allow the io.Copy).
Please let me know if I missed something silly. 🙂

Signed-off-by: jolheiser <john.olheiser@gmail.com>
@jolheiser jolheiser added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Feb 1, 2021
@jolheiser jolheiser added this to the 1.15.0 milestone Feb 1, 2021
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Feb 7, 2021
@techknowlogick techknowlogick modified the milestones: 1.15.0, 1.16.0 Jun 15, 2021
@jolheiser jolheiser mentioned this pull request Jul 14, 2021
@lunny
Copy link
Member

lunny commented Aug 18, 2021

Please resolve the conflicts.

# Conflicts:
#	routers/web/repo/repo.go
#	services/archiver/archiver.go
#	templates/repo/home.tmpl
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
@jolheiser
Copy link
Member Author

This should be ready to test again.

  1. Sorry for the unrelated changes, I'm not sure whether GoLand or gofmt is responsible for the build tags (my guess is the former), but they have been duplicated because the old style has been deprecated in favor of //go:build
  2. Due to bundles needing to be written to a file (rather than to stdout), I had to re-add code to temporarily store them until they could be piped out to the caller.

@lunny
Copy link
Member

lunny commented Aug 23, 2021

Since .zip and .tar.gz will only include current branch codes, it's confusing that this will bundle --all. Maybe add two menu items, one is for current branch another is --all.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
@jolheiser
Copy link
Member Author

Alright, this now downloads a bundle at the current branch/commit.

After merging, I will follow up with a PR that adds the --all bundle to repo settings, as it's more of a complete backup option.

@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2021

Codecov Report

Merging #14538 (6800427) into main (1cd4a3b) will decrease coverage by 0.00%.
The diff coverage is 17.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14538      +/-   ##
==========================================
- Coverage   45.50%   45.49%   -0.01%     
==========================================
  Files         762      762              
  Lines       85940    85973      +33     
==========================================
+ Hits        39108    39117       +9     
- Misses      40521    40546      +25     
+ Partials     6311     6310       -1     
Impacted Files Coverage Δ
cmd/embedded_stub.go 0.00% <ø> (ø)
modules/auth/pam/pam_stub.go 0.00% <ø> (ø)
modules/git/blob_nogogit.go 61.19% <ø> (ø)
modules/git/commit_info_nogogit.go 60.60% <ø> (ø)
modules/git/last_commit_cache_nogogit.go 35.84% <ø> (ø)
modules/git/notes_nogogit.go 71.42% <ø> (ø)
modules/git/parse_nogogit.go 56.32% <ø> (ø)
modules/git/pipeline/lfs_nogogit.go 0.00% <ø> (ø)
modules/git/repo.go 43.31% <0.00%> (-4.40%) ⬇️
modules/git/repo_archive.go 0.00% <0.00%> (ø)
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d22cb60...6800427. Read the comment docs.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 24, 2021
@jolheiser jolheiser merged commit 648464b into go-gitea:main Aug 24, 2021
@jolheiser jolheiser deleted the bundle branch August 24, 2021 16:47
@axifive axifive mentioned this pull request Sep 17, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants