pub fn including_branches(
    repository: &Path,
    target: &str,
) -> Result<Vec<String>, Error> {
    let output = process::Command::new("git")
        .args(&["branch", "--contains", target])
        .current_dir(repository)
        .stdin(process::Stdio::null())
        .stderr(process::Stdio::inherit())
        .output()?;
    if !output.status.success() {
        return Err(Error::Git(format!(
            "`git branch --contains` returned {}",
            output.status
        )));
    }
    let mut refs = Vec::new();
    for line in output.stdout.split(|&b| b == b'\n') {
        let line = std::str::from_utf8(line)
            .map_err(|_| Error::git("Non-utf8 branch name"))?
            .trim();
        if line.is_empty().not() {
            refs.push(line.into());
        }
    }
    Ok(refs)
}
/// List all the branches that include the given one (e.g. more recent)
///
/// Those are branches that keep the given branch alive, making it superfluous
/// for garbage-collection-prevention purposes.
List all the branches that include the given one
Those are branches that keep the given branch alive, making it superfluous
for garbage-collection-prevention purposes.
List all the branches that include the given one Those are branches that keep the given branch alive making it superfluous for garbage - collection - prevention purposes .
pub fn including_branches(
    repository: &Path,
    target: &str,
) -> Result<Vec<String>, Error> {
    let output = process::Command::new("git")
        .args(&["branch", "--contains", target])
        .current_dir(repository)
        .stdin(process::Stdio::null())
        .stderr(process::Stdio::inherit())
        .output()?;
    if !output.status.success() {
        return Err(Error::Git(format!(
            "`git branch --contains` returned {}",
            output.status
        )));
    }
    let mut refs = Vec::new();
    for line in output.stdout.split(|&b| b == b'\n') {
        let line = std::str::from_utf8(line)
            .map_err(|_| Error::git("Non-utf8 branch name"))?
            .trim();
        if line.is_empty().not() {
            refs.push(line.into());
        }
    }
    Ok(refs)
}
pub fn including_branches ( repository : & Path , target : & str , ) -> Result < Vec < String > , Error > { let output = process :: Command :: new ( " " ) . args ( & [ " " , " " , target ] ) . current_dir ( repository ) . stdin ( process :: Stdio :: null ( ) ) . stderr ( process :: Stdio :: inherit ( ) ) . output ( ) ? ; if ! output . status . success ( ) { return Err ( Error :: Git ( format ! ( " " output status ) ) ) ; } let mut refs = Vec :: new ( ) ; for line in output . stdout . split ( | & b | b == b'\n' ) { let line = std :: str :: from_utf8 ( line ) . map_err ( | _ | Error :: git ( " " ) ) ? . trim ( ) ; if line . is_empty ( ) . not ( ) { refs . push ( line . into ( ) ) ; } } Ok ( refs ) }
List all the branches that include the given one (e.g.
List all the branches that include the given one ( e . g .
repository
&Path
target
&str
repository
&Path
target
&str