huskies: merge 927

This commit is contained in:
dave
2026-05-12 17:49:44 +00:00
parent b8945654bf
commit 03a99b3cf1
33 changed files with 119 additions and 25 deletions
+1 -12
View File
@@ -4,6 +4,7 @@
//! HEAD, formatted for readability in chat.
use super::CommandContext;
use crate::chat::util::truncate_at_char_boundary;
use std::path::Path;
use std::process::Command;
@@ -125,18 +126,6 @@ fn run_git(dir: &Path, args: &[&str]) -> String {
.unwrap_or_default()
}
/// Truncate `s` to at most `max_bytes` bytes without splitting a UTF-8 character.
fn truncate_at_char_boundary(s: &str, max_bytes: usize) -> &str {
if s.len() <= max_bytes {
return s;
}
let mut boundary = max_bytes;
while !s.is_char_boundary(boundary) {
boundary -= 1;
}
&s[..boundary]
}
// ---------------------------------------------------------------------------
// Tests
// ---------------------------------------------------------------------------