| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
use super::*; |
| 11 |
use std::time::UNIX_EPOCH; |
| 12 |
|
| 13 |
#[derive(Debug, Clone, Default, PartialEq, Eq)] |
| 14 |
pub struct PromptInfo { |
| 15 |
pub bookmark: String, |
| 16 |
|
| 17 |
pub change_id: String, |
| 18 |
pub heads: usize, |
| 19 |
pub dirty: bool, |
| 20 |
pub conflicted: bool, |
| 21 |
|
| 22 |
pub ahead: Option<usize>, |
| 23 |
pub behind: Option<usize>, |
| 24 |
} |
| 25 |
|
| 26 |
impl PromptInfo { |
| 27 |
|
| 28 |
|
| 29 |
pub fn state_glyph(&self) -> &'static str { |
| 30 |
if self.conflicted { |
| 31 |
"‼" |
| 32 |
} else if self.dirty { |
| 33 |
"✎" |
| 34 |
} else { |
| 35 |
"✔" |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
pub fn state_color(&self) -> u8 { |
| 41 |
if self.conflicted { |
| 42 |
31 |
| 43 |
} else if self.dirty { |
| 44 |
33 |
| 45 |
} else { |
| 46 |
36 |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
pub fn format_colored(&self, fmt: &str, guard: (&str, &str)) -> String { |
| 53 |
format!( |
| 54 |
"{}\x1b[{}m{}{}{}\x1b[0m{}", |
| 55 |
guard.0, |
| 56 |
self.state_color(), |
| 57 |
guard.1, |
| 58 |
self.format(fmt), |
| 59 |
guard.0, |
| 60 |
guard.1 |
| 61 |
) |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
pub fn format(&self, fmt: &str) -> String { |
| 70 |
let mut out = String::new(); |
| 71 |
let mut chars = fmt.chars(); |
| 72 |
while let Some(c) = chars.next() { |
| 73 |
if c != '%' { |
| 74 |
out.push(c); |
| 75 |
continue; |
| 76 |
} |
| 77 |
match chars.next() { |
| 78 |
Some('b') => out.push_str(&self.bookmark), |
| 79 |
Some('c') => out.push_str(&self.change_id), |
| 80 |
Some('h') => out.push_str(&self.heads.to_string()), |
| 81 |
Some('d') => { |
| 82 |
if self.dirty { |
| 83 |
out.push('*'); |
| 84 |
} |
| 85 |
} |
| 86 |
Some('x') => { |
| 87 |
if self.conflicted { |
| 88 |
out.push('!'); |
| 89 |
} |
| 90 |
} |
| 91 |
Some('a') => out.push_str(&self.ahead.map(|n| n.to_string()).unwrap_or_default()), |
| 92 |
Some('B') => out.push_str(&self.behind.map(|n| n.to_string()).unwrap_or_default()), |
| 93 |
Some('A') => { |
| 94 |
if let Some(n) = self.ahead.filter(|n| *n > 0) { |
| 95 |
out.push_str(&format!("+{n}")); |
| 96 |
} |
| 97 |
} |
| 98 |
Some('D') => { |
| 99 |
if let Some(n) = self.behind.filter(|n| *n > 0) { |
| 100 |
out.push_str(&format!("-{n}")); |
| 101 |
} |
| 102 |
} |
| 103 |
Some('s') => out.push_str(self.state_glyph()), |
| 104 |
Some('U') => { |
| 105 |
if let Some(n) = self.ahead.filter(|n| *n > 0) { |
| 106 |
out.push_str(&format!("↑{n}")); |
| 107 |
} |
| 108 |
} |
| 109 |
Some('O') => { |
| 110 |
if let Some(n) = self.behind.filter(|n| *n > 0) { |
| 111 |
out.push_str(&format!("↓{n}")); |
| 112 |
} |
| 113 |
} |
| 114 |
Some('i') => out.push_str(ICON), |
| 115 |
Some('%') => out.push('%'), |
| 116 |
Some(other) => { |
| 117 |
out.push('%'); |
| 118 |
out.push(other); |
| 119 |
} |
| 120 |
None => out.push('%'), |
| 121 |
} |
| 122 |
} |
| 123 |
out |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
#[derive(Clone, Debug)] |
| 131 |
pub(crate) struct ManifestEntry { |
| 132 |
pub size: u64, |
| 133 |
pub mtime_ns: u128, |
| 134 |
pub hash: String, |
| 135 |
pub blob: Option<ObjectRef>, |
| 136 |
|
| 137 |
|
| 138 |
pub graph: Option<String>, |
| 139 |
|
| 140 |
|
| 141 |
pub exec: bool, |
| 142 |
} |
| 143 |
|
| 144 |
#[derive(Clone, Debug, Default)] |
| 145 |
pub(crate) struct Manifest { |
| 146 |
|
| 147 |
pub written_ns: u128, |
| 148 |
pub entries: BTreeMap<String, ManifestEntry>, |
| 149 |
} |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
pub(crate) type CachedManifest = ((u64, u128, u64), (bool, bool, std::sync::Arc<Manifest>)); |
| 154 |
|
| 155 |
pub(crate) fn mtime_ns(m: &fs::Metadata) -> u128 { |
| 156 |
m.modified() |
| 157 |
.ok() |
| 158 |
.and_then(|t| t.duration_since(UNIX_EPOCH).ok()) |
| 159 |
.map(|d| d.as_nanos()) |
| 160 |
.unwrap_or(0) |
| 161 |
} |
| 162 |
|
| 163 |
pub const DEFAULT_PROMPT_FORMAT: &str = "%b %c%d%x%A%D"; |
| 164 |
|
| 165 |
pub const ICON: &str = "⚛"; |
| 166 |
|
| 167 |
pub const GLYPH_PROMPT_FORMAT: &str = "%i %b %c %s%U%O"; |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
fn manifest_line( |
| 172 |
path: &str, |
| 173 |
size: u64, |
| 174 |
mtime_ns: u128, |
| 175 |
hash: &str, |
| 176 |
blob: Option<ObjectRef>, |
| 177 |
graph: Option<&str>, |
| 178 |
exec: bool, |
| 179 |
) -> String { |
| 180 |
format!( |
| 181 |
"{size}\t{mtime_ns}\t{hash}\t{}\t{}\t{}\t{path}\n", |
| 182 |
blob.map(|b| b.to_hex()).unwrap_or_else(|| "-".into()), |
| 183 |
graph.unwrap_or("-"), |
| 184 |
if exec { "x" } else { "-" } |
| 185 |
) |
| 186 |
} |
| 187 |
|
| 188 |
impl Repo { |
| 189 |
pub(crate) fn manifest_path(&self) -> PathBuf { |
| 190 |
self.oxy |
| 191 |
.join("workspaces") |
| 192 |
.join(self.workspace.to_hex()) |
| 193 |
.join("manifest") |
| 194 |
} |
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
pub(crate) fn write_manifest(&self, conflicted: bool, uncommitted: bool) -> Result<()> { |
| 200 |
let entries = self.walk_working_copy()?; |
| 201 |
self.write_manifest_entries(conflicted, uncommitted, &entries, &HashMap::new()) |
| 202 |
} |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
pub(crate) fn write_manifest_entries( |
| 207 |
&self, |
| 208 |
conflicted: bool, |
| 209 |
uncommitted: bool, |
| 210 |
entries: &BTreeMap<String, FsEntry>, |
| 211 |
blobs: &HashMap<String, ObjectRef>, |
| 212 |
) -> Result<()> { |
| 213 |
self.manifest_cache.take(); |
| 214 |
self.listing_cache.take(); |
| 215 |
let written = std::time::SystemTime::now() |
| 216 |
.duration_since(UNIX_EPOCH) |
| 217 |
.map(|d| d.as_nanos()) |
| 218 |
.unwrap_or(0); |
| 219 |
let head = format!( |
| 220 |
"# conflicted={}\n# uncommitted={}\n", |
| 221 |
conflicted as u8, uncommitted as u8 |
| 222 |
); |
| 223 |
let mut body = String::new(); |
| 224 |
let mut newest_ns: u128 = 0; |
| 225 |
for (path, e) in entries { |
| 226 |
let full = self.root.join(path); |
| 227 |
let (size, mtime_ns) = match fs::symlink_metadata(&full) { |
| 228 |
Ok(m) => (m.len(), mtime_ns(&m)), |
| 229 |
Err(_) => (e.content.len() as u64, 0), |
| 230 |
}; |
| 231 |
let hash = match &e.content_hash { |
| 232 |
Some(h) => h.clone(), |
| 233 |
None => blake3::hash(&e.content).to_hex().to_string(), |
| 234 |
}; |
| 235 |
let blob = blobs.get(path).copied().or(e.blob); |
| 236 |
newest_ns = newest_ns.max(mtime_ns); |
| 237 |
body.push_str(&manifest_line( |
| 238 |
path, |
| 239 |
size, |
| 240 |
mtime_ns, |
| 241 |
&hash, |
| 242 |
blob, |
| 243 |
e.graph_key.as_deref(), |
| 244 |
e.exec, |
| 245 |
)); |
| 246 |
} |
| 247 |
let p = self.manifest_path(); |
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
if let Ok(old) = fs::read_to_string(&p) { |
| 253 |
let old_written: Option<u128> = old.lines().find_map(|l| { |
| 254 |
l.strip_prefix("# written=") |
| 255 |
.and_then(|v| v.trim().parse().ok()) |
| 256 |
}); |
| 257 |
let old_rest: String = old |
| 258 |
.lines() |
| 259 |
.filter(|l| !l.starts_with("# written=")) |
| 260 |
.map(|l| format!("{l}\n")) |
| 261 |
.collect(); |
| 262 |
if let Some(w) = old_written { |
| 263 |
if old_rest == format!("{head}{body}") && newest_ns + 2_000_000_000 < w { |
| 264 |
return Ok(()); |
| 265 |
} |
| 266 |
} |
| 267 |
} |
| 268 |
let text = format!("{head}# written={written}\n{body}"); |
| 269 |
fs::create_dir_all(p.parent().unwrap())?; |
| 270 |
write_atomic(&p, text.as_bytes()) |
| 271 |
} |
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
pub(crate) fn rewrite_manifest( |
| 277 |
&self, |
| 278 |
conflicted: bool, |
| 279 |
uncommitted: bool, |
| 280 |
keys: &HashMap<String, String>, |
| 281 |
) -> Result<()> { |
| 282 |
self.manifest_cache.take(); |
| 283 |
self.listing_cache.take(); |
| 284 |
let p = self.manifest_path(); |
| 285 |
let text = match fs::read_to_string(&p) { |
| 286 |
Ok(t) => t, |
| 287 |
Err(_) => return self.write_manifest(conflicted, uncommitted), |
| 288 |
}; |
| 289 |
let mut out = String::with_capacity(text.len()); |
| 290 |
for line in text.lines() { |
| 291 |
if line.starts_with("# conflicted=") { |
| 292 |
out.push_str(&format!("# conflicted={}\n", conflicted as u8)); |
| 293 |
} else if line.starts_with("# uncommitted=") { |
| 294 |
out.push_str(&format!("# uncommitted={}\n", uncommitted as u8)); |
| 295 |
} else { |
| 296 |
let f: Vec<&str> = line.splitn(7, '\t').collect(); |
| 297 |
match (f.len() == 7).then(|| keys.get(f[6])).flatten() { |
| 298 |
Some(k) => out.push_str(&format!( |
| 299 |
"{}\t{}\t{}\t{}\t{k}\t{}\t{}\n", |
| 300 |
f[0], f[1], f[2], f[3], f[5], f[6] |
| 301 |
)), |
| 302 |
None => { |
| 303 |
out.push_str(line); |
| 304 |
out.push('\n'); |
| 305 |
} |
| 306 |
} |
| 307 |
} |
| 308 |
} |
| 309 |
write_atomic(&p, out.as_bytes()) |
| 310 |
} |
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
pub(crate) fn drop_manifest(&self) { |
| 316 |
self.manifest_cache.take(); |
| 317 |
self.listing_cache.take(); |
| 318 |
let _ = fs::remove_file(self.manifest_path()); |
| 319 |
} |
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
pub(crate) fn read_manifest(&self) -> Result<Option<(bool, bool, std::sync::Arc<Manifest>)>> { |
| 324 |
let path = self.manifest_path(); |
| 325 |
let id = match fs::metadata(&path) { |
| 326 |
Ok(m) => { |
| 327 |
#[cfg(unix)] |
| 328 |
let ino = std::os::unix::fs::MetadataExt::ino(&m); |
| 329 |
#[cfg(not(unix))] |
| 330 |
let ino = 0; |
| 331 |
(m.len(), mtime_ns(&m), ino) |
| 332 |
} |
| 333 |
Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(None), |
| 334 |
Err(e) => return Err(e.into()), |
| 335 |
}; |
| 336 |
if let Some((cached_id, m)) = &*self.manifest_cache.borrow() { |
| 337 |
if *cached_id == id { |
| 338 |
return Ok(Some(m.clone())); |
| 339 |
} |
| 340 |
} |
| 341 |
let Some((c, u, m)) = self.parse_manifest(&path)? else { |
| 342 |
return Ok(None); |
| 343 |
}; |
| 344 |
let m = (c, u, std::sync::Arc::new(m)); |
| 345 |
*self.manifest_cache.borrow_mut() = Some((id, m.clone())); |
| 346 |
Ok(Some(m)) |
| 347 |
} |
| 348 |
|
| 349 |
fn parse_manifest(&self, path: &std::path::Path) -> Result<Option<(bool, bool, Manifest)>> { |
| 350 |
let text = match fs::read_to_string(path) { |
| 351 |
Ok(t) => t, |
| 352 |
Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(None), |
| 353 |
Err(e) => return Err(e.into()), |
| 354 |
}; |
| 355 |
let mut out = Manifest::default(); |
| 356 |
let mut conflicted = false; |
| 357 |
let mut uncommitted = false; |
| 358 |
for line in text.lines() { |
| 359 |
if let Some(v) = line.strip_prefix("# conflicted=") { |
| 360 |
conflicted = v.trim() == "1"; |
| 361 |
continue; |
| 362 |
} |
| 363 |
if let Some(v) = line.strip_prefix("# uncommitted=") { |
| 364 |
uncommitted = v.trim() == "1"; |
| 365 |
continue; |
| 366 |
} |
| 367 |
if let Some(v) = line.strip_prefix("# written=") { |
| 368 |
out.written_ns = v.trim().parse().unwrap_or(u128::MAX); |
| 369 |
continue; |
| 370 |
} |
| 371 |
|
| 372 |
|
| 373 |
let f: Vec<&str> = line.splitn(7, '\t').collect(); |
| 374 |
if f.len() == 7 { |
| 375 |
out.entries.insert( |
| 376 |
f[6].to_string(), |
| 377 |
ManifestEntry { |
| 378 |
size: f[0].parse().unwrap_or(0), |
| 379 |
mtime_ns: f[1].parse().unwrap_or(0), |
| 380 |
hash: f[2].to_string(), |
| 381 |
blob: ObjectRef::from_hex(f[3]), |
| 382 |
graph: (f[4] != "-").then(|| f[4].to_string()), |
| 383 |
exec: f[5] == "x", |
| 384 |
}, |
| 385 |
); |
| 386 |
} |
| 387 |
} |
| 388 |
Ok(Some((conflicted, uncommitted, out))) |
| 389 |
} |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
pub fn clean_by_manifest(&self) -> Result<bool> { |
| 399 |
let _t = crate::timing::phase("status: check the manifest"); |
| 400 |
let Some((conflicted, uncommitted, m)) = self.read_manifest()? else { |
| 401 |
return Ok(false); |
| 402 |
}; |
| 403 |
if conflicted || uncommitted || self.root.join(".oxymodules").exists() { |
| 404 |
return Ok(false); |
| 405 |
} |
| 406 |
let racy = m |
| 407 |
.entries |
| 408 |
.values() |
| 409 |
.any(|e| e.mtime_ns + 2_000_000_000 >= m.written_ns); |
| 410 |
if racy { |
| 411 |
return Ok(false); |
| 412 |
} |
| 413 |
Ok(self.quick_dirty_keeping(true)? == Some(false)) |
| 414 |
} |
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
pub fn quick_dirty(&self) -> Result<Option<bool>> { |
| 419 |
self.quick_dirty_keeping(false) |
| 420 |
} |
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
fn quick_dirty_keeping(&self, keep: bool) -> Result<Option<bool>> { |
| 425 |
let Some((_, uncommitted, manifest)) = self.read_manifest()? else { |
| 426 |
return Ok(None); |
| 427 |
}; |
| 428 |
if uncommitted { |
| 429 |
return Ok(Some(true)); |
| 430 |
} |
| 431 |
use rayon::prelude::*; |
| 432 |
let sparse = &self.config.sparse_paths; |
| 433 |
let in_scope = |p: &str| { |
| 434 |
sparse.is_empty() |
| 435 |
|| sparse |
| 436 |
.iter() |
| 437 |
.any(|s| p == s || p.starts_with(&format!("{s}/"))) |
| 438 |
}; |
| 439 |
|
| 440 |
let Ok(listing) = super::walk::list(&self.root, &in_scope) else { |
| 441 |
return Ok(Some(true)); |
| 442 |
}; |
| 443 |
let differs = || -> Result<bool> { |
| 444 |
let links_differ = listing.symlinks.iter().any(|(rel, target)| { |
| 445 |
manifest |
| 446 |
.entries |
| 447 |
.get(rel) |
| 448 |
.is_none_or(|me| blake3::hash(target).to_hex().as_str() != me.hash) |
| 449 |
}); |
| 450 |
if links_differ { |
| 451 |
return Ok(true); |
| 452 |
} |
| 453 |
|
| 454 |
|
| 455 |
let files_differ = listing.files.par_iter().any(|(rel, path, m)| { |
| 456 |
manifest.entries.get(rel).is_none_or(|me| { |
| 457 |
m.len() != me.size |
| 458 |
|| super::is_executable(m) != me.exec |
| 459 |
|| (mtime_ns(m) != me.mtime_ns |
| 460 |
&& !fs::read(path) |
| 461 |
.is_ok_and(|b| blake3::hash(&b).to_hex().as_str() == me.hash)) |
| 462 |
}) |
| 463 |
}); |
| 464 |
if files_differ { |
| 465 |
return Ok(true); |
| 466 |
} |
| 467 |
let seen = listing.files.len() + listing.symlinks.len(); |
| 468 |
if seen == manifest.entries.len() { |
| 469 |
return Ok(false); |
| 470 |
} |
| 471 |
|
| 472 |
|
| 473 |
for (rel, me) in &manifest.entries { |
| 474 |
let path = self.root.join(rel); |
| 475 |
let Ok(m) = fs::symlink_metadata(&path) else { |
| 476 |
return Ok(true); |
| 477 |
}; |
| 478 |
if m.file_type().is_symlink() { |
| 479 |
continue; |
| 480 |
} |
| 481 |
if m.len() != me.size |
| 482 |
|| super::is_executable(&m) != me.exec |
| 483 |
|| (mtime_ns(&m) != me.mtime_ns |
| 484 |
&& blake3::hash(&fs::read(&path)?).to_hex().as_str() != me.hash) |
| 485 |
{ |
| 486 |
return Ok(true); |
| 487 |
} |
| 488 |
} |
| 489 |
Ok(false) |
| 490 |
}; |
| 491 |
let dirty = differs()?; |
| 492 |
if dirty && keep { |
| 493 |
*self.listing_cache.borrow_mut() = Some(listing); |
| 494 |
} |
| 495 |
Ok(Some(dirty)) |
| 496 |
} |
| 497 |
|
| 498 |
|
| 499 |
pub fn quick_status(&self) -> Result<PromptInfo> { |
| 500 |
let view = self.view()?; |
| 501 |
let bookmark = self.config.bookmark.clone(); |
| 502 |
let heads = self.heads_of(&view, &bookmark)?; |
| 503 |
let wc_hash = view.workspaces.get(&self.workspace).copied(); |
| 504 |
let change_id = match wc_hash { |
| 505 |
Some(h) => self.store.get_change_meta(&h)?.change_id.short(8), |
| 506 |
None => String::new(), |
| 507 |
}; |
| 508 |
|
| 509 |
|
| 510 |
let manifest = self.read_manifest()?; |
| 511 |
let conflicted = manifest.as_ref().map(|(c, _, _)| *c).unwrap_or(false); |
| 512 |
let dirty = self.quick_dirty()?.unwrap_or(false); |
| 513 |
let (ahead, behind) = match view.remotes.get("origin").and_then(|b| b.get(&bookmark)) { |
| 514 |
Some(st) => { |
| 515 |
let remote_heads = self.store.get_state(st)?.heads; |
| 516 |
let ahead = self.negotiate(&remote_heads, &heads).map(|v| v.len()).ok(); |
| 517 |
let behind = self.negotiate(&heads, &remote_heads).map(|v| v.len()).ok(); |
| 518 |
(ahead, behind) |
| 519 |
} |
| 520 |
None => (None, None), |
| 521 |
}; |
| 522 |
Ok(PromptInfo { |
| 523 |
bookmark, |
| 524 |
change_id, |
| 525 |
heads: heads.len(), |
| 526 |
dirty, |
| 527 |
conflicted, |
| 528 |
ahead, |
| 529 |
behind, |
| 530 |
}) |
| 531 |
} |
| 532 |
} |
| 533 |
|
| 534 |
#[cfg(test)] |
| 535 |
mod tests { |
| 536 |
use super::*; |
| 537 |
|
| 538 |
#[test] |
| 539 |
fn placeholders_and_glyphs() { |
| 540 |
let clean = PromptInfo { |
| 541 |
bookmark: "main".into(), |
| 542 |
change_id: "658990aa".into(), |
| 543 |
heads: 1, |
| 544 |
dirty: false, |
| 545 |
conflicted: false, |
| 546 |
ahead: Some(0), |
| 547 |
behind: None, |
| 548 |
}; |
| 549 |
assert_eq!(clean.format(DEFAULT_PROMPT_FORMAT), "main 658990aa"); |
| 550 |
assert_eq!(clean.format(GLYPH_PROMPT_FORMAT), "⚛ main 658990aa ✔"); |
| 551 |
let busy = PromptInfo { |
| 552 |
dirty: true, |
| 553 |
ahead: Some(2), |
| 554 |
behind: Some(3), |
| 555 |
..clean.clone() |
| 556 |
}; |
| 557 |
assert_eq!(busy.format(DEFAULT_PROMPT_FORMAT), "main 658990aa*+2-3"); |
| 558 |
assert_eq!(busy.format(GLYPH_PROMPT_FORMAT), "⚛ main 658990aa ✎↑2↓3"); |
| 559 |
let bad = PromptInfo { |
| 560 |
conflicted: true, |
| 561 |
..busy.clone() |
| 562 |
}; |
| 563 |
assert_eq!(bad.format("%s%x%d %h %a/%B %%"), "‼!* 1 2/3 %"); |
| 564 |
assert_eq!(bad.state_color(), 31); |
| 565 |
assert_eq!( |
| 566 |
busy.format_colored("%b", ("\\[", "\\]")), |
| 567 |
"\\[\x1b[33m\\]main\\[\x1b[0m\\]" |
| 568 |
); |
| 569 |
assert_eq!(clean.format_colored("%b", ("", "")), "\x1b[36mmain\x1b[0m"); |
| 570 |
assert_eq!(clean.format("%q"), "%q"); |
| 571 |
} |
| 572 |
} |