-
-
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
Refactor editor upload, update and delete to use git plumbing and add LFS support #5702
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5702 +/- ##
=========================================
Coverage ? 38.82%
=========================================
Files ? 344
Lines ? 49355
Branches ? 0
=========================================
Hits ? 19163
Misses ? 27428
Partials ? 2764
Continue to review full report at Codecov.
|
As previously described in #5621 this provides around a 10x speed up on the current implementation even for very small repositories. Speed ups for large repositories should be considerably better. |
This is a change from the previous code but is more in keeping with the default behaviour of git. Signed-off-by: Andrew Thornton <[email protected]>
See verify_path in: https://github.com/git/git/blob/7f4e64169352e03476b0ea64e7e2973669e491a2/read-cache.c#L951 Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Upload.go is essentially the remnants of repo_editor.go. The remaining code is essentially unchanged from the Gogs code, hence the Gogs attribution.
see go-gitea#5774 Signed-off-by: Andrew Thornton <[email protected]>
8686557
to
d0d28c9
Compare
800d6c3
to
d6ceb0c
Compare
…ke-upload-not-clone
Signed-off-by: Andrew Thornton <[email protected]>
@lunny needs your review. |
Signed-off-by: Andrew Thornton <[email protected]>
Ping @lunny |
Make lg TM work |
Any way to retain commit history when a file is renamed in the GUI? Now it deletes the old file, makes a new file. That isn't the behavior of GitHub when you change the name or path of an existing file. |
@richmahn please submit issue for this |
When uploading files using the GUI, Gitea currently does:
a) A full clone - Including the whole object DB
b) A full branch checkout - every file
c) Copies the uploaded file to this cloned repository
d) Add/stages the changes
e) Commits
f) Pushes to the real repository
g) Cleans up the cloned repository - deleting the whole object db and checkout.
This is extremely inefficient.
This PR takes a different approach and, instead of using the git porcelain commands (git add and the like), uses the plumbing commands to (hopefully) significantly speed up this process. See my comments in #601 (#601 (comment)).
The basics of this code was in #5621, however, there has been significant refactoring with code moved out of
models.Repository
into a module calleduploader
. LFS support has been added, with transparent recognition of whether a file should be added to the LFS through checking the git attributes.Issues
ORIGINAL_SSH_COMMAND
so the push hooks may not actually run. This is to stay in keeping with the current implementation - however, could be very easily set.Will fix #5600. Will fix #4778. Will fix #3557. Will fix #5727.