pub fn git_to_yocto_git_url(url: &str, name: Option<&str>, prefix: GitPrefix) -> String {
    // check if its a git@github.com:cardoe/cargo-bitbake.git style URL
    // and fix it up if it is
    let fixed_url = if SSH_STYLE_REMOTE.is_match(url) {
        format!("ssh://{}", url.replace(":", "/"))
    } else {
        url.to_string()
    };

    // convert the protocol to one that Yocto understands
    // https://... -> git://...;protocol=https
    // ssh://... -> git://...;protocol=ssh
    // and append metadata necessary for Yocto to generate
    // data for Cargo to understand
    let yocto_url = match fixed_url.split_at(fixed_url.find(':').unwrap()) {
        (proto @ "ssh", rest) | (proto @ "http", rest) | (proto @ "https", rest) => {
            format!("{}{};protocol={}", prefix, rest, proto)
        }
        (_, _) => fixed_url.to_owned(),
    };

    // by default bitbake only look for SHAs and refs on the master branch.
    let yocto_url = format!("{};nobranch=1", yocto_url);

    if let Some(name) = name {
        format!("{};name={};destsuffix={}", yocto_url, name, name)
    } else {
        yocto_url
    }
}
/// converts a GIT URL to a Yocto GIT URL
converts a GIT URL to a Yocto GIT URL
converts a GIT URL to a Yocto GIT URL
pub fn git_to_yocto_git_url(url: &str, name: Option<&str>, prefix: GitPrefix) -> String {
    // check if its a git@github.com:cardoe/cargo-bitbake.git style URL
    // and fix it up if it is
    let fixed_url = if SSH_STYLE_REMOTE.is_match(url) {
        format!("ssh://{}", url.replace(":", "/"))
    } else {
        url.to_string()
    };
    // convert the protocol to one that Yocto understands
    // https://... -> git://...;protocol=https
    // ssh://... -> git://...;protocol=ssh
    // and append metadata necessary for Yocto to generate
    // data for Cargo to understand
    let yocto_url = match fixed_url.split_at(fixed_url.find(':').unwrap()) {
        (proto @ "ssh", rest) | (proto @ "http", rest) | (proto @ "https", rest) => {
            format!("{}{};protocol={}", prefix, rest, proto)
        }
        (_, _) => fixed_url.to_owned(),
    };
    // by default bitbake only look for SHAs and refs on the master branch.
    let yocto_url = format!("{};nobranch=1", yocto_url);
    if let Some(name) = name {
        format!("{};name={};destsuffix={}", yocto_url, name, name)
    } else {
        yocto_url
    }
}
pub fn git_to_yocto_git_url ( url : & str , name : Option < & str > , prefix : GitPrefix ) -> String { // check if its a git@github.com:cardoe/cargo-bitbake.git style URL // and fix it up if it is let fixed_url = if SSH_STYLE_REMOTE . is_match ( url ) { format ! ( " " url replace ( " " " " ) ) } else { url . to_string ( ) } ; // convert the protocol to one that Yocto understands // https://... -> git://...;protocol=https // ssh://... -> git://...;protocol=ssh // and append metadata necessary for Yocto to generate // data for Cargo to understand let yocto_url = match fixed_url . split_at ( fixed_url . find ( ':' ) . unwrap ( ) ) { ( proto @ " " , rest ) | ( proto @ " " , rest ) | ( proto @ " " , rest ) => { format ! ( " " prefix rest proto ) } ( _ , _ ) => fixed_url . to_owned ( ) , } ; // by default bitbake only look for SHAs and refs on the master branch. let yocto_url = format ! ( " " yocto_url ) ; if let Some ( name ) = name { format ! ( " " yocto_url name name ) } else { yocto_url } }
converts a GIT URL to a Yocto GIT URL
converts a GIT URL to a Yocto GIT URL
url
&str
name
Option<&str>
prefix
GitPrefix
url
&str
name
Option<&str>
prefix
GitPrefix