pub fn read_ref(name: &str) -> GitResult<String> {
    let data = {
        let mut buf = String::new();
        let mut f = File::open(&Path::new(".git").join(name))?;
        f.read_to_string(&mut buf)?;
        // Don't need a newline
        buf.pop();
        buf
    };

    if data.starts_with("ref: ") {
        // Symbolic ref
        read_ref(&data[5..])
    } else {
        Ok(data)
    }
}
// Read a ref, recurse if there is ever a symbolic ref
// TODO: deal with symbolic ref loops
Read a ref, recurse if there is ever a symbolic ref
TODO: deal with symbolic ref loops
Read a ref recurse if there is ever a symbolic ref TODO : deal with symbolic ref loops
pub fn read_ref(name: &str) -> GitResult<String> {
    let data = {
        let mut buf = String::new();
        let mut f = File::open(&Path::new(".git").join(name))?;
        f.read_to_string(&mut buf)?;
        // Don't need a newline
        buf.pop();
        buf
    };
    if data.starts_with("ref: ") {
        // Symbolic ref
        read_ref(&data[5..])
    } else {
        Ok(data)
    }
}
pub fn read_ref ( name : & str ) -> GitResult < String > { let data = { let mut buf = String :: new ( ) ; let mut f = File :: open ( & Path :: new ( " " ) . join ( name ) ) ? ; f . read_to_string ( & mut buf ) ? ; // Don't need a newline buf . pop ( ) ; buf } ; if data . starts_with ( " " ) { // Symbolic ref read_ref ( & data [ 5 .. ] ) } else { Ok ( data ) } }
Read a ref, recurse if there is ever a symbolic ref
TODO: deal with symbolic ref loops
Read a ref recurse if there is ever a symbolic ref TODO : deal with symbolic ref loops
name
&str
name
&str