1
0

Improve button container layout in renderer and add unit test for preserving commit identities after rewording.

This commit is contained in:
2026-07-12 11:28:15 +02:00
parent f087e13267
commit f047d61731
2 changed files with 25 additions and 1 deletions

View File

@@ -604,7 +604,7 @@ window.addEventListener('DOMContentLoaded', async () => {
<span>${new Date(c.date).toLocaleString()}</span>
</div>
<div class="text-gray-800 mb-2">${c.message}</div>
<div class="flex space-x-2 mb-2">
<div class="flex flex-wrap gap-2 mb-2">
<button class="diff-btn flex items-center px-2 py-1 text-xs border rounded hover:bg-gray-100" data-hash="${c.hash}">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1 rotate" viewBox="0 0 24 24"
stroke="currentColor" fill="none">

View File

@@ -4315,4 +4315,28 @@ mod tests {
"Create the root fixture"
);
}
#[test]
fn pending_descendant_identity_survives_an_older_commit_reword() {
let temp = init_test_repo();
let path = temp.path().to_str().unwrap();
let older = test_commit(path, "older.txt", "older", "auto-git: [create] older.txt");
let newer = test_commit(path, "newer.txt", "newer", "auto-git: [create] newer.txt");
let identity = identities_for_hashes(path, std::slice::from_ref(&newer))
.remove(&newer)
.unwrap();
let mut messages = HashMap::new();
messages.insert(older.clone(), "Create the older fixture".to_string());
reword_commits_sequentially(path, &messages, &[older]).unwrap();
let remapped = current_commit_identities(path).remove(&identity).unwrap();
assert_ne!(remapped, newer);
assert_eq!(
run_git(path, &["show", "-s", "--format=%s", &remapped])
.unwrap()
.trim(),
"auto-git: [create] newer.txt"
);
}
}