diff options
author | 2023-01-13 16:04:06 -0800 | |
---|---|---|
committer | 2023-01-13 16:04:06 -0800 | |
commit | 9c2a7c6b823162714a303df9407c86951975d144 (patch) | |
tree | 5a5fed7c796f90e181ad47c4407a9c4cbf0724d6 /src/install/repository.zig | |
parent | 766f8ceebc76dd749ba5c104f802c7ebda289db9 (diff) | |
download | bun-9c2a7c6b823162714a303df9407c86951975d144.tar.gz bun-9c2a7c6b823162714a303df9407c86951975d144.tar.zst bun-9c2a7c6b823162714a303df9407c86951975d144.zip |
git cache folder resolverdylan/github-dependencies
Diffstat (limited to 'src/install/repository.zig')
-rw-r--r-- | src/install/repository.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/install/repository.zig b/src/install/repository.zig index d53fca8d5..f6c663bec 100644 --- a/src/install/repository.zig +++ b/src/install/repository.zig @@ -99,6 +99,19 @@ pub const Repository = extern struct { return buf[0..i]; } + pub fn getURLForClone(this: Repository, lockfile: *Lockfile, buf: *[bun.MAX_PATH_BYTES]u8) []u8 { + var url = this.getURL(lockfile, buf); + + // replace ':' with '/' if it exists to make a valid url + if (strings.lastIndexOfChar(url, ':')) |j| { + if (url[j + 1] != '/') { + url[j] = '/'; + } + } + + return url; + } + pub fn getCacheDirectoryForGitHub(this: Repository, manager: *PackageManager, buf: *[bun.MAX_PATH_BYTES]u8) ![]u8 { var url_buf: [bun.MAX_PATH_BYTES]u8 = undefined; const url = this.getGitHubURL(manager.lockfile, &url_buf); |