[PR #5621] [CLOSED] Use git plumbing for upload rather than porcelain #17873

Closed
opened 2025-11-02 16:22:22 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/5621
Author: @zeripath
Created: 1/2/2019
Status: Closed

Base: masterHead: make-upload-not-clone


📝 Commits (8)

  • 845e249 Use git plumbing for upload: #5621 repo_editor.go: UploadRepoFile
  • 9ffd9b6 Use git plumbing for upload: #5621 repo_editor.go: GetDiffPreview
  • 5394c64 Use git plumbing for upload: #5621 repo_editor.go: DeleteRepoFile
  • c4fde84 Use git plumbing for upload: #5621 repo_editor.go: UploadRepoFiles
  • 2f8ec3d Move branch checkout functions out of repo_editor.go as they are no longer used there
  • 03d5f29 BUGFIX: The default permissions should be 100644
  • 6cccf32 Standardise cleanUploadFilename to more closely match git
  • 23b43cd Redirect on bad paths

📊 Changes

4 files changed (+468 additions, -200 deletions)

View changed files

📝 models/repo_branch.go (+40 -0)
📝 models/repo_editor.go (+385 -186)
📝 routers/repo/editor.go (+37 -9)
📝 routers/repo/editor_test.go (+6 -5)

📄 Description

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 (https://github.com/go-gitea/gitea/issues/601#issuecomment-450194075).

Currently my approach is to use the git-cli commands which can/could be migrated to go-git commands later.

Will fix #5600.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/5621 **Author:** [@zeripath](https://github.com/zeripath) **Created:** 1/2/2019 **Status:** ❌ Closed **Base:** `master` ← **Head:** `make-upload-not-clone` --- ### 📝 Commits (8) - [`845e249`](https://github.com/go-gitea/gitea/commit/845e24929ad31955135e3968af30b2fbfeb94972) Use git plumbing for upload: #5621 repo_editor.go: UploadRepoFile - [`9ffd9b6`](https://github.com/go-gitea/gitea/commit/9ffd9b6b760dd9c417e8d0fae4f091d1613f932b) Use git plumbing for upload: #5621 repo_editor.go: GetDiffPreview - [`5394c64`](https://github.com/go-gitea/gitea/commit/5394c645816fe525b4c8656a454385e480c74984) Use git plumbing for upload: #5621 repo_editor.go: DeleteRepoFile - [`c4fde84`](https://github.com/go-gitea/gitea/commit/c4fde8486200b7b104ea5a85ea2d04f72205f1a9) Use git plumbing for upload: #5621 repo_editor.go: UploadRepoFiles - [`2f8ec3d`](https://github.com/go-gitea/gitea/commit/2f8ec3d6e63c2718947c2f30481cbc09029b14f8) Move branch checkout functions out of repo_editor.go as they are no longer used there - [`03d5f29`](https://github.com/go-gitea/gitea/commit/03d5f29bac58c61eba2e5fb1cac745afc34bde7f) BUGFIX: The default permissions should be 100644 - [`6cccf32`](https://github.com/go-gitea/gitea/commit/6cccf32b31f260f2c6195f3375a66f3fcc461cb9) Standardise cleanUploadFilename to more closely match git - [`23b43cd`](https://github.com/go-gitea/gitea/commit/23b43cdead69e117433656be69b320c19738baa7) Redirect on bad paths ### 📊 Changes **4 files changed** (+468 additions, -200 deletions) <details> <summary>View changed files</summary> 📝 `models/repo_branch.go` (+40 -0) 📝 `models/repo_editor.go` (+385 -186) 📝 `routers/repo/editor.go` (+37 -9) 📝 `routers/repo/editor_test.go` (+6 -5) </details> ### 📄 Description 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 (https://github.com/go-gitea/gitea/issues/601#issuecomment-450194075). Currently my approach is to use the git-cli commands which can/could be migrated to go-git commands later. Will fix #5600. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 16:22:22 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17873