diff --git a/ceres/src/lfs/handler.rs b/ceres/src/lfs/handler.rs index 4641a7438..6737b897f 100644 --- a/ceres/src/lfs/handler.rs +++ b/ceres/src/lfs/handler.rs @@ -177,7 +177,10 @@ pub async fn lfs_delete_lock( } } -/// Process batch request. +/// +/// +/// Reference: +/// 1. [Git LFS Batch API](https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md) pub async fn lfs_process_batch( config: &LfsConfig, mut batch_vars: BatchRequest, @@ -197,7 +200,7 @@ pub async fn lfs_process_batch( let found = meta.is_ok(); let mut meta = meta.unwrap_or_default(); if found && lfs_file_exist(config, &meta).await { - // originla download method, split mode use `` + // original download method, split mode use `` response_objects.push(represent(object, &meta, batch_vars.operation == "download", false, false, &server_url).await); continue; } diff --git a/mono/src/server/https_server.rs b/mono/src/server/https_server.rs index 6465a0300..602b75b10 100644 --- a/mono/src/server/https_server.rs +++ b/mono/src/server/https_server.rs @@ -173,15 +173,22 @@ pub async fn app(config: Config, host: String, port: u16, common: CommonOptions) } lazy_static! { - //GET + /// The [LFS Server Discovery](https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md) + /// document describes the server LFS discovery protocol. + /// + /// The following regular expressions are used to match the LFS server discovery protocol. + /// static ref OBJECTS_REGEX: Regex = Regex::new(r"/objects/[a-z0-9]+$").unwrap(); static ref LOCKS_REGEX: Regex = Regex::new(r"/locks$").unwrap(); - static ref INFO_REFS_REGEX: Regex = Regex::new(r"/info/refs$").unwrap(); - //POST + static ref REGEX_LOCKS_VERIFY: Regex = Regex::new(r"/locks/verify$").unwrap(); static ref REGEX_UNLOCK: Regex = Regex::new(r"/unlock$").unwrap(); static ref REGEX_OBJECTS_BATCH: Regex = Regex::new(r"/objects/batch$").unwrap(); - static ref REGEX_OBJECTS_CHUNKIDS: Regex = Regex::new(r"objects/chunkids$").unwrap(); + + static ref REGEX_OBJECTS_CHUNKIDS: Regex = Regex::new(r"/objects/chunkids$").unwrap(); + + /// Git Protocol + static ref INFO_REFS_REGEX: Regex = Regex::new(r"/info/refs$").unwrap(); static ref REGEX_GIT_UPLOAD_PACK: Regex = Regex::new(r"/git-upload-pack$").unwrap(); static ref REGEX_GIT_RECEIVE_PACK: Regex = Regex::new(r"/git-receive-pack$").unwrap(); }