From 555b603c1be8bfb83ec0ec452140a47cdae395c1 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 1 Apr 2026 15:46:10 -0400 Subject: [PATCH] Allow amend commits in FakeGitRepository even when index matches HEAD Real git allows amend commits to rewrite the commit message even when the tree is unchanged. The fake implementation was rejecting these with 'nothing to commit', breaking git_panel::tests::test_amend. --- crates/fs/src/fake_git_repo.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/fs/src/fake_git_repo.rs b/crates/fs/src/fake_git_repo.rs index 477d83907f26e2694297f9b6d4dafb1aedbf7eb6..12ad38056ee5e9886609ad993f842061e338f158 100644 --- a/crates/fs/src/fake_git_repo.rs +++ b/crates/fs/src/fake_git_repo.rs @@ -883,7 +883,8 @@ impl GitRepository for FakeGitRepository { _env: Arc>, ) -> BoxFuture<'_, Result<()>> { self.with_state_async(true, move |state| { - if !options.allow_empty && state.index_contents == state.head_contents { + if !options.allow_empty && !options.amend && state.index_contents == state.head_contents + { anyhow::bail!("nothing to commit (use allow_empty to create an empty commit)"); }