Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f652e607f6 | ||
|
|
8c4361acee |
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"sha256": {
|
||||
"aarch64-apple-darwin": "ba5711a2cf4b27f5b37963e9562088f6f0159b3f87fdca1a4ca8258f510667d0",
|
||||
"x86_64-unknown-linux-musl": "3d134d6cbc0035f609772dcda2a3dfa55f688c7bb5a30410e2091fa1f13aeba0"
|
||||
"aarch64-apple-darwin": "388fedc4ffac34756cfb234953c4b7355017bd68b23a953f6f6ce908b33fbdab",
|
||||
"x86_64-unknown-linux-musl": "f5911d985f2d392783c12e7e130f4ced098a8f4b2dea1a9ebb83fb7c73ef54aa"
|
||||
}
|
||||
}
|
||||
+23
-1
@@ -757,7 +757,7 @@ fn test_output(app: &App, id: &str) -> Pager {
|
||||
fn diff_of(worktree: &str) -> Pager {
|
||||
let git = |a: &[&str]| crate::run::git(Path::new(worktree), a);
|
||||
let mut text = String::new();
|
||||
match git(&["status", "--short"]) {
|
||||
match git(&["status", "--short", "--untracked-files=all"]) {
|
||||
Ok(s) if !s.trim().is_empty() => text.push_str(&format!("{s}\n")),
|
||||
Ok(_) => {}
|
||||
Err(e) => text.push_str(&format!("{e:#}\n")),
|
||||
@@ -767,6 +767,20 @@ fn diff_of(worktree: &str) -> Pager {
|
||||
Ok(s) => text.push_str(&s),
|
||||
Err(e) => text.push_str(&format!("{e:#}")),
|
||||
}
|
||||
// `git diff HEAD` skips untracked files: show them as additions too.
|
||||
// `--no-index` exits 1 when the files differ, so read stdout and ignore the status.
|
||||
for f in git(&["ls-files", "--others", "--exclude-standard"])
|
||||
.unwrap_or_default()
|
||||
.lines()
|
||||
{
|
||||
if let Ok(o) = std::process::Command::new("git")
|
||||
.args(["diff", "--no-index", "--", "/dev/null", f])
|
||||
.current_dir(worktree)
|
||||
.output()
|
||||
{
|
||||
text.push_str(&String::from_utf8_lossy(&o.stdout));
|
||||
}
|
||||
}
|
||||
Pager {
|
||||
title: "diff".into(),
|
||||
lines: lines_of(&text),
|
||||
@@ -1435,6 +1449,14 @@ end = "escalated"
|
||||
assert!(tr.lines.last().unwrap().contains("ended: escalated"));
|
||||
// the agent's (here: the shell's) untracked file shows up in the diff view
|
||||
assert!(diff_of(&d.worktree).lines.iter().any(|l| l == "?? n"));
|
||||
// files inside a new folder are listed one by one, not collapsed to "sub/"
|
||||
std::fs::create_dir_all(Path::new(&d.worktree).join("sub")).unwrap();
|
||||
std::fs::write(Path::new(&d.worktree).join("sub/f"), "x").unwrap();
|
||||
let lines = diff_of(&d.worktree).lines;
|
||||
assert!(lines.iter().any(|l| l == "?? sub/f"));
|
||||
// and its content appears as an added file
|
||||
assert!(lines.iter().any(|l| l == "+++ b/sub/f"), "{lines:?}");
|
||||
assert!(lines.iter().any(|l| l == "+x"), "{lines:?}");
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user