pub fn expand_refname(refname: &str) -> GitResult<String> {
    let to_try = [
        Path::new(refname).to_path_buf(),
        Path::new("refs").join(refname),
        Path::new("refs/tags").join(refname),
        Path::new("refs/heads").join(refname),
        Path::new("refs/remotes").join(refname),
        Path::new("refs/heads").join(refname).join("HEAD"),
    ];
    for path in to_try.iter() {
        if Path::new(".git").join(path).is_file() {
            return match path.to_str() {
                Some(s) => Ok(String::from(s)),
                None => Err("Invalid UTF-8 string".into()),
            };
        }
    }
    Err("unknown revision or refname not in the working tree".into())
}
// Find the ref that corresponds to a refname, and read it
Find the ref that corresponds to a refname, and read it
Find the ref that corresponds to a refname and read it
pub fn expand_refname(refname: &str) -> GitResult<String> {
    let to_try = [
        Path::new(refname).to_path_buf(),
        Path::new("refs").join(refname),
        Path::new("refs/tags").join(refname),
        Path::new("refs/heads").join(refname),
        Path::new("refs/remotes").join(refname),
        Path::new("refs/heads").join(refname).join("HEAD"),
    ];
    for path in to_try.iter() {
        if Path::new(".git").join(path).is_file() {
            return match path.to_str() {
                Some(s) => Ok(String::from(s)),
                None => Err("Invalid UTF-8 string".into()),
            };
        }
    }
    Err("unknown revision or refname not in the working tree".into())
}
pub fn expand_refname ( refname : & str ) -> GitResult < String > { let to_try = [ Path :: new ( refname ) . to_path_buf ( ) , Path :: new ( " " ) . join ( refname ) , Path :: new ( " " ) . join ( refname ) , Path :: new ( " " ) . join ( refname ) , Path :: new ( " " ) . join ( refname ) , Path :: new ( " " ) . join ( refname ) . join ( " " ) , ] ; for path in to_try . iter ( ) { if Path :: new ( " " ) . join ( path ) . is_file ( ) { return match path . to_str ( ) { Some ( s ) => Ok ( String :: from ( s ) ) , None => Err ( " " . into ( ) ) , } ; } } Err ( " " . into ( ) ) }
Find the ref that corresponds to a refname, and read it
Find the ref that corresponds to a refname and read it
refname
&str
refname
&str