Fix spurious addition hunks in files with no git repo (#24288)

Cole Miller created

Release Notes:

- N/A

Change summary

crates/editor/src/editor.rs     | 6 ++----
crates/worktree/src/worktree.rs | 4 ++--
2 files changed, 4 insertions(+), 6 deletions(-)

Detailed changes

crates/editor/src/editor.rs 🔗

@@ -14478,10 +14478,8 @@ fn get_uncommitted_changes_for_buffer(
         let change_sets = futures::future::join_all(tasks).await;
         buffer
             .update(&mut cx, |buffer, cx| {
-                for change_set in change_sets {
-                    if let Some(change_set) = change_set.log_err() {
-                        buffer.add_change_set(change_set, cx);
-                    }
+                for change_set in change_sets.into_iter().flatten() {
+                    buffer.add_change_set(change_set, cx);
                 }
             })
             .ok();

crates/worktree/src/worktree.rs 🔗

@@ -886,7 +886,7 @@ impl Worktree {
                             }
                         }
                     }
-                    Ok(None)
+                    Err(anyhow!("No repository found for {path:?}"))
                 })
             }
             Worktree::Remote(_) => {
@@ -910,7 +910,7 @@ impl Worktree {
                             }
                         }
                     }
-                    Ok(None)
+                    Err(anyhow!("No repository found for {path:?}"))
                 })
             }
             Worktree::Remote(_) => Task::ready(Err(anyhow!(