Allow amend commits in FakeGitRepository even when index matches HEAD

Richard Feldman created

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.

Change summary

crates/fs/src/fake_git_repo.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Detailed changes

crates/fs/src/fake_git_repo.rs 🔗

@@ -883,7 +883,8 @@ impl GitRepository for FakeGitRepository {
         _env: Arc<HashMap<String, String>>,
     ) -> 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)");
             }