bit_remote

Remote URL parsing and .git path resolution (gix-url + gix-discover)

git
remote
url
moon add mizchi/bit_remote@0.46.4
Download zip
Author
Version
0.46.4
License
Apache-2.0
Last updated
4 days ago
Downloads
494
README

#
GitHubShorthand

pub(all) enum GitHubShorthand {
Repo(String, String?)
Subdir(String, String, String?)
File(String, String)
} derive(Eq,
Debug
)

Clone target result

#
check_shorthand_ambiguity

fn check_shorthand_ambiguity(url : String, dir_exists : (String) -> Bool) -> String?

Check if shorthand conflicts with local directory. Returns the conflicting path if ambiguous.

#
detect_git_dir

fn detect_git_dir(fs : &
RepoFileSystem
, path : String) -> (String, Bool)?

#
is_bare_git_dir

fn is_bare_git_dir(git_dir : String) -> Bool

#
parse_github_shorthand

fn parse_github_shorthand(url : String) -> GitHubShorthand?

Parse clone shorthand or GitHub browser URL.

Supports:
  1. user/repo -> Repo clone (GitHub)
  2. user/repo:path -> Subdir clone with sparse checkout
  3. user/repo@ref -> Repo clone at ref
  4. user/repo@ref:path -> Subdir clone at ref
  5. gitlab.com/user/repo -> Repo clone (other hosts)
  6. gitlab.com/user/repo:path -> Subdir clone (other hosts)
  7. https://github.com/user/repo/tree/branch/path -> Subdir clone
  8. https://github.com/user/repo/blob/branch/path -> Single file fetch

Examples:
  • "user/repo" -> Repo("https://github.com/user/repo")
  • "user/repo:src" -> Subdir("https://github.com/user/repo", "src")
  • "user/repo@main" -> Repo("https://github.com/user/repo", Some("main"))
  • "user/repo@main:src" -> Subdir("https://github.com/user/repo", "src", Some("main"))
  • "gitlab.com/user/repo" -> Repo("https://gitlab.com/user/repo")
  • "https://github.com/user/repo/tree/main/src" -> Subdir(url, "src")

#
resolve_gitdir

fn resolve_gitdir(fs : &
RepoFileSystem
, bit_path : String) -> String

Resolve .git file to actual git directory (for submodules)

#
resolve_local_repo_path

fn resolve_local_repo_path(fs : &
RepoFileSystem
, root : String, url : String) -> String?

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io