fn truncate_tree_stack(stack: &mut Vec<(Vec<u8>, Tree)>, at: usize)
        -> GitResult<Digest> {
    let mut result: Option<Digest> = None;
    while stack.len() > at {
        let (name, tree) = match stack.pop() {
            Some(tup) => tup,
            // This probably can't happen
            None => return Err(GitError::from("Unexpected error")),
        };
        // Write the tre
        let digest = tree.as_object().write()?;

        // Add an entry for tree in its parent
        match stack.last_mut() {
            Some(&mut (_, ref mut parent)) => parent.entries.push(TreeEntry {
                mode: EntryMode::Tree,
                name: name,
                hash: digest.bytes(),
            }),
            None => (),
        }
        result = Some(digest);
    }
    match result {
        Some(digest) => Ok(digest),
        None => Err(GitError::from("Tried to truncate empty stack")),
    }
}
// Remove and write the trees on the stack starting from position at
// Return the hash of the highest level tree written
Remove and write the trees on the stack starting from position at
Return the hash of the highest level tree written
Remove and write the trees on the stack starting from position at Return the hash of the highest level tree written
fn truncate_tree_stack(stack: &mut Vec<(Vec<u8>, Tree)>, at: usize)
        -> GitResult<Digest> {
    let mut result: Option<Digest> = None;
    while stack.len() > at {
        let (name, tree) = match stack.pop() {
            Some(tup) => tup,
            // This probably can't happen
            None => return Err(GitError::from("Unexpected error")),
        };
        // Write the tre
        let digest = tree.as_object().write()?;
        // Add an entry for tree in its parent
        match stack.last_mut() {
            Some(&mut (_, ref mut parent)) => parent.entries.push(TreeEntry {
                mode: EntryMode::Tree,
                name: name,
                hash: digest.bytes(),
            }),
            None => (),
        }
        result = Some(digest);
    }
    match result {
        Some(digest) => Ok(digest),
        None => Err(GitError::from("Tried to truncate empty stack")),
    }
}
fn truncate_tree_stack ( stack : & mut Vec < ( Vec < u8 > , Tree ) > , at : usize ) -> GitResult < Digest > { let mut result : Option < Digest > = None ; while stack . len ( ) > at { let ( name , tree ) = match stack . pop ( ) { Some ( tup ) => tup , // This probably can't happen None => return Err ( GitError :: from ( " " ) ) , } ; // Write the tre let digest = tree . as_object ( ) . write ( ) ? ; // Add an entry for tree in its parent match stack . last_mut ( ) { Some ( & mut ( _ , ref mut parent ) ) => parent . entries . push ( TreeEntry { mode : EntryMode :: Tree , name : name , hash : digest . bytes ( ) , } ) , None => ( ) , } result = Some ( digest ) ; } match result { Some ( digest ) => Ok ( digest ) , None => Err ( GitError :: from ( " " ) ) , } }
Remove and write the trees on the stack starting from position at
Return the hash of the highest level tree written
Remove and write the trees on the stack starting from position at Return the hash of the highest level tree written
stack
&mut Vec<(Vec<u8>, Tree)>
at
usize
stack
&mut Vec<(Vec<u8>, Tree)>
at
usize