diff --git a/npm/lib.d.ts b/npm/lib.d.ts index 8f66fa55..38aad398 100644 --- a/npm/lib.d.ts +++ b/npm/lib.d.ts @@ -179,6 +179,7 @@ export type BitResetMode = "soft" | "mixed" | "hard"; export interface BitFetchOptions { refspec?: string; preferV2?: boolean; + depth?: number; preferredSender?: string; preferredRepo?: string; authToken?: string; @@ -186,6 +187,7 @@ export interface BitFetchOptions { export interface BitCloneOptions { preferV2?: boolean; + depth?: number; preferredSender?: string; preferredRepo?: string; authToken?: string; diff --git a/npm/lib.js b/npm/lib.js index a11d2b5f..80d7d0a7 100644 --- a/npm/lib.js +++ b/npm/lib.js @@ -1034,6 +1034,7 @@ export const fetch = async ( toTransportId(transport), options.refspec ?? "", options.preferV2 !== false, + options.depth ?? 0, ), ); }; @@ -1061,6 +1062,7 @@ export const clone = async ( resolvedRemoteUrl, toTransportId(transport), options.preferV2 !== false, + options.depth ?? 0, ), ); }; diff --git a/src/lib/js_api_exports.mbt b/src/lib/js_api_exports.mbt index 329524fd..668cee9d 100644 --- a/src/lib/js_api_exports.mbt +++ b/src/lib/js_api_exports.mbt @@ -1393,6 +1393,7 @@ pub async fn js_clone_remote( remote_url : String, transport_id : Int, prefer_v2 : Bool, + depth : Int, ) -> Result[JsCloneResult, String] { let fs = js_make_host_fs(host_id) js_wrap_error_async(async fn() -> JsCloneResult raise @bit.GitError { @@ -1429,7 +1430,7 @@ pub async fn js_clone_remote( remote_url, wants, prefer_v2, - 0, + depth, @protocol.FilterSpec::NoFilter, async fn( url : String, @@ -1486,9 +1487,10 @@ pub fn js_clone_remote_promise( remote_url : String, transport_id : Int, prefer_v2 : Bool, + depth : Int, ) -> @js_async.Promise[Result[JsCloneResult, String]] { js_export_promise(async fn() { - js_clone_remote(host_id, root, remote_url, transport_id, prefer_v2) + js_clone_remote(host_id, root, remote_url, transport_id, prefer_v2, depth) }) } @@ -1500,6 +1502,7 @@ pub async fn js_fetch_remote( transport_id : Int, refspec : String, prefer_v2 : Bool, + depth : Int, ) -> Result[JsFetchResult, String] { let fs = js_make_host_fs(host_id) js_wrap_error_async(async fn() -> JsFetchResult raise @bit.GitError { @@ -1528,7 +1531,7 @@ pub async fn js_fetch_remote( remote_url, [commit_id], prefer_v2, - 0, + depth, @protocol.FilterSpec::NoFilter, async fn( url : String, @@ -1577,9 +1580,10 @@ pub fn js_fetch_remote_promise( transport_id : Int, refspec : String, prefer_v2 : Bool, + depth : Int, ) -> @js_async.Promise[Result[JsFetchResult, String]] { js_export_promise(async fn() { - js_fetch_remote(host_id, root, remote_url, transport_id, refspec, prefer_v2) + js_fetch_remote(host_id, root, remote_url, transport_id, refspec, prefer_v2, depth) }) }