feat(history-ui): add resizable commit history aside
The commit history panel is now resizable with a draggable handle and keyboard support. The chosen width is persisted in local storage so the layout stays consistent across sessions. Git commit loading was also adjusted to include all branch tips for a more complete graph. - Add width persistence and pointer/keyboard resizing for history panel - Update commit graph query to use topo-order across all refs - Extend tests to ensure branch tips are included in commit results
This commit is contained in:
@@ -996,6 +996,8 @@ fn commits_for_repo(repo: &Path, limit: Option<u32>) -> Result<Vec<GitCommit>, S
|
||||
repo,
|
||||
[
|
||||
"log",
|
||||
"--all",
|
||||
"--topo-order",
|
||||
"--decorate=short",
|
||||
"--name-status",
|
||||
"-M",
|
||||
@@ -3869,6 +3871,33 @@ mod tests {
|
||||
assert!(comparison.patch.contains("+original"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn commits_for_repo_includes_all_branch_tips_for_graph() {
|
||||
let repo = init_temp_repo("commits_all_branches");
|
||||
commit_initial_file(&repo.path);
|
||||
let base_branch = git_output_test(&repo.path, ["rev-parse", "--abbrev-ref", "HEAD"]);
|
||||
|
||||
run_git_test(&repo.path, ["checkout", "-q", "-b", "feature/graph"]);
|
||||
fs::write(repo.path.join("feature.txt"), "feature\n")
|
||||
.expect("feature file should be written");
|
||||
run_git_test(&repo.path, ["add", "feature.txt"]);
|
||||
run_git_test(&repo.path, ["commit", "-q", "-m", "feature graph"]);
|
||||
let feature_commit = git_output_test(&repo.path, ["rev-parse", "HEAD"]);
|
||||
|
||||
run_git_test(&repo.path, ["checkout", "-q", base_branch.as_str()]);
|
||||
fs::write(repo.path.join("main.txt"), "main\n").expect("main file should be written");
|
||||
run_git_test(&repo.path, ["add", "main.txt"]);
|
||||
run_git_test(&repo.path, ["commit", "-q", "-m", "main graph"]);
|
||||
let main_commit = git_output_test(&repo.path, ["rev-parse", "HEAD"]);
|
||||
|
||||
let commits = commits_for_repo(&repo.path, Some(10)).expect("commits should load");
|
||||
|
||||
assert!(commits.iter().any(|commit| commit.hash == main_commit));
|
||||
assert!(commits.iter().any(|commit| {
|
||||
commit.hash == feature_commit && commit.refs.iter().any(|r| r.contains("feature/graph"))
|
||||
}));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(
|
||||
windows,
|
||||
|
||||
Reference in New Issue
Block a user