[PR #120] [CLOSED] Git LFS support #15162

Closed
opened 2025-11-02 11:40:17 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/120
Author: @fabian-z
Created: 11/8/2016
Status: Closed

Base: masterHead: develop


📝 Commits (10+)

  • 58375e6 Update dependency versions
  • aca09ac Import github.com/git-lfs/lfs-test-server as lfs module base
  • ff281f9 Remove config, add JWT support from github.com/mgit-at/lfs-test-server
  • 5265ad1 Add LFS settings
  • 7423b5b Add LFS meta object model
  • 46d770f Add LFS routes and initialization
  • 52d7fff Adapt LFS module: handlers, routing, meta store
  • 0f95196 Move LFS routes to /user/repo/info/lfs/*
  • 8c8fdeb Add request header checks to LFS BatchHandler / PostHandler
  • 3c11ce9 Implement LFS basic authentication

📊 Changes

16 files changed (+2012 additions, -1141 deletions)

View changed files

📝 cmd/serve.go (+57 -3)
📝 cmd/web.go (+7 -1)
📝 conf/locale/locale_en-US.ini (+3 -0)
📝 glide.lock (+171 -30)
models/lfs.go (+98 -0)
📝 models/models.go (+1 -1)
📝 models/repo.go (+58 -0)
📝 modules/auth/user_form.go (+1 -0)
📝 modules/base/tool.go (+13 -0)
📝 modules/bindata/bindata.go (+885 -1106)
modules/lfs/LICENSE (+19 -0)
modules/lfs/content_store.go (+94 -0)
modules/lfs/server.go (+528 -0)
📝 modules/setting/setting.go (+53 -0)
📝 routers/install.go (+19 -0)
📝 templates/install.tmpl (+5 -0)

📄 Description

PR as requested by @lunny, merge conflicts originate from gitea commits. I'm using Gogs as upstream so I can't promise to correct those. Original PR: gogits/gogs#3868

Feature requested in gogits/gogs#1322

This PR implements Git LFS support for Gogs, supporting the legacy v1 API as well as the current batch v1 API.

Originally imported LFS server code base from https://github.com/git-lfs/lfs-test-server.

Features:

  • Uses recommended paths with HTTP and SSH remotes, no custom user settings necessary
  • Supports basic authentication with user credentials
  • Supports authentication with SSH (passing JWT under the hood)
  • Supports no authentication when pulling public repositories (however git-lfs still asks for credentials, where the prompt can be skipped - likely a bug in git-lfs)
  • Settings transparently integrated into installation process
  • Removes LFS objects when repositories are deleted. Works with forks (e.g. when parent repository is deleted)

Notes:

  • 58375e6b86 was necessary to import github.com/dgrijalva/jwt-go, as well as fix gogits/gogs#3732
  • Does not yet delete LFS objects when repository is removed
  • 0344f98166 regenerates bindata in order to apply locale additions from c166480ab0

Looking forward to your review!


🔄 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/120 **Author:** [@fabian-z](https://github.com/fabian-z) **Created:** 11/8/2016 **Status:** ❌ Closed **Base:** `master` ← **Head:** `develop` --- ### 📝 Commits (10+) - [`58375e6`](https://github.com/go-gitea/gitea/commit/58375e6b8648527597339b4b4b042fa71cf41b76) Update dependency versions - [`aca09ac`](https://github.com/go-gitea/gitea/commit/aca09acd36af6e92e8743dba1df5a90dfe1fd149) Import github.com/git-lfs/lfs-test-server as lfs module base - [`ff281f9`](https://github.com/go-gitea/gitea/commit/ff281f94ab107b4e92f8fdba8edb613ef1dacebf) Remove config, add JWT support from github.com/mgit-at/lfs-test-server - [`5265ad1`](https://github.com/go-gitea/gitea/commit/5265ad15e4285b166bb0e5d908f3bb6eab94021d) Add LFS settings - [`7423b5b`](https://github.com/go-gitea/gitea/commit/7423b5bd9858bb6fd6e87dd63cc17d2963221144) Add LFS meta object model - [`46d770f`](https://github.com/go-gitea/gitea/commit/46d770f41ee3baad0fcb7c567760ed98410a7909) Add LFS routes and initialization - [`52d7fff`](https://github.com/go-gitea/gitea/commit/52d7fff865762c22d8a263da10ad888b361f3af3) Adapt LFS module: handlers, routing, meta store - [`0f95196`](https://github.com/go-gitea/gitea/commit/0f95196699a66199481465361f44c871a23ebf90) Move LFS routes to /user/repo/info/lfs/* - [`8c8fdeb`](https://github.com/go-gitea/gitea/commit/8c8fdebca21945a587e681542c2a7e9ec78bdc24) Add request header checks to LFS BatchHandler / PostHandler - [`3c11ce9`](https://github.com/go-gitea/gitea/commit/3c11ce9e5604bf04d0fbefa002ca6f487c328083) Implement LFS basic authentication ### 📊 Changes **16 files changed** (+2012 additions, -1141 deletions) <details> <summary>View changed files</summary> 📝 `cmd/serve.go` (+57 -3) 📝 `cmd/web.go` (+7 -1) 📝 `conf/locale/locale_en-US.ini` (+3 -0) 📝 `glide.lock` (+171 -30) ➕ `models/lfs.go` (+98 -0) 📝 `models/models.go` (+1 -1) 📝 `models/repo.go` (+58 -0) 📝 `modules/auth/user_form.go` (+1 -0) 📝 `modules/base/tool.go` (+13 -0) 📝 `modules/bindata/bindata.go` (+885 -1106) ➕ `modules/lfs/LICENSE` (+19 -0) ➕ `modules/lfs/content_store.go` (+94 -0) ➕ `modules/lfs/server.go` (+528 -0) 📝 `modules/setting/setting.go` (+53 -0) 📝 `routers/install.go` (+19 -0) 📝 `templates/install.tmpl` (+5 -0) </details> ### 📄 Description **PR as requested by @lunny, merge conflicts originate from gitea commits. I'm using [Gogs](https://github.com/gogits/gogs) as upstream so I can't promise to correct those. Original PR: gogits/gogs#3868** Feature requested in gogits/gogs#1322 This PR implements Git LFS support for Gogs, supporting the [legacy v1 API](https://github.com/github/git-lfs/blob/master/docs/api/v1/http-v1-legacy.md) as well as the current [batch v1 API](https://github.com/github/git-lfs/blob/master/docs/api/v1/http-v1-batch.md). Originally imported LFS server code base from https://github.com/git-lfs/lfs-test-server. Features: * Uses [recommended paths](https://github.com/github/git-lfs/tree/master/docs/api) with HTTP and SSH remotes, no custom user settings necessary * Supports basic authentication with user credentials * Supports [authentication with SSH](https://github.com/github/git-lfs/tree/master/docs/api) (passing JWT under the hood) * Supports no authentication when pulling public repositories (however git-lfs still asks for credentials, where the prompt can be skipped - likely a bug in git-lfs) * Settings transparently integrated into installation process * Removes LFS objects when repositories are deleted. Works with forks (e.g. when parent repository is deleted) Notes: * https://github.com/fabian-z/gogs/commit/58375e6b8648527597339b4b4b042fa71cf41b76 was necessary to import ```github.com/dgrijalva/jwt-go```, as well as fix gogits/gogs#3732 * ~Does not yet delete LFS objects when repository is removed~ * https://github.com/fabian-z/gogs/commit/0344f98166058a0e58d425fc5d25967c6f5901cc regenerates bindata in order to apply locale additions from https://github.com/fabian-z/gogs/commit/c166480ab0b5118ed9b7fbecb257406fdfab2daf Looking forward to your review! --- <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 11:40:17 -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#15162