rho-coding-agent 3.12.0

A fast Rust agent harness with a small footprint and opinionated defaults
Documentation
1
2
3
4
5
6
7
8
9
10
use std::path::Path;

pub(super) fn git_branch(cwd: &Path) -> Option<String> {
    let git_dir = cwd.ancestors().find_map(crate::git::git_dir_at)?;
    let head = crate::git::read_small(&git_dir.join("HEAD"))?;
    let head = head.trim();
    head.strip_prefix("ref: refs/heads/")
        .map(ToString::to_string)
        .or_else(|| head.get(..7).map(ToString::to_string))
}