git: Revert "Ignore whitespace in git blame invocation" (#44648)

Reverts zed-industries/zed#35960
cc @cole-miller

---------

Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Piotr Osiewicz
2025-12-12 14:28:25 +01:00
committed by GitHub
co-authored by Cole Miller
parent 18d344e118
commit 47c30b6da7
6 changed files with 50 additions and 29 deletions
+7 -1
View File
@@ -23,6 +23,7 @@ use std::{
path::PathBuf,
sync::{Arc, LazyLock},
};
use text::LineEnding;
use util::{paths::PathStyle, rel_path::RelPath};
pub static LOAD_INDEX_TEXT_TASK: LazyLock<TaskLabel> = LazyLock::new(TaskLabel::new);
@@ -452,7 +453,12 @@ impl GitRepository for FakeGitRepository {
})
}
fn blame(&self, path: RepoPath, _content: Rope) -> BoxFuture<'_, Result<git::blame::Blame>> {
fn blame(
&self,
path: RepoPath,
_content: Rope,
_line_ending: LineEnding,
) -> BoxFuture<'_, Result<git::blame::Blame>> {
self.with_state_async(false, move |state| {
state
.blames
+2 -21
View File
@@ -803,7 +803,7 @@ impl Fs for RealFs {
}
let file = smol::fs::File::create(path).await?;
let mut writer = smol::io::BufWriter::with_capacity(buffer_size, file);
for chunk in chunks(text, line_ending) {
for chunk in text::chunks_with_line_ending(text, line_ending) {
writer.write_all(chunk.as_bytes()).await?;
}
writer.flush().await?;
@@ -2555,7 +2555,7 @@ impl Fs for FakeFs {
async fn save(&self, path: &Path, text: &Rope, line_ending: LineEnding) -> Result<()> {
self.simulate_random_delay().await;
let path = normalize_path(path);
let content = chunks(text, line_ending).collect::<String>();
let content = text::chunks_with_line_ending(text, line_ending).collect::<String>();
if let Some(path) = path.parent() {
self.create_dir(path).await?;
}
@@ -2773,25 +2773,6 @@ impl Fs for FakeFs {
}
}
fn chunks(rope: &Rope, line_ending: LineEnding) -> impl Iterator<Item = &str> {
rope.chunks().flat_map(move |chunk| {
let mut newline = false;
let end_with_newline = chunk.ends_with('\n').then_some(line_ending.as_str());
chunk
.lines()
.flat_map(move |line| {
let ending = if newline {
Some(line_ending.as_str())
} else {
None
};
newline = true;
ending.into_iter().chain([line])
})
.chain(end_with_newline)
})
}
pub fn normalize_path(path: &Path) -> PathBuf {
let mut components = path.components().peekable();
let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() {