mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Fix repository initialization bug
This commit is contained in:
parent
04041af78b
commit
5e2aaf45a0
@ -1248,6 +1248,16 @@ impl Editor {
|
|||||||
|
|
||||||
let soft_wrap_mode_override =
|
let soft_wrap_mode_override =
|
||||||
(mode == EditorMode::SingleLine).then(|| settings::SoftWrap::None);
|
(mode == EditorMode::SingleLine).then(|| settings::SoftWrap::None);
|
||||||
|
|
||||||
|
let mut project_subscription = None;
|
||||||
|
if mode == EditorMode::Full && buffer.read(cx).is_singleton() {
|
||||||
|
if let Some(project) = project.as_ref() {
|
||||||
|
project_subscription = Some(cx.observe(project, |_, _, cx| {
|
||||||
|
cx.emit(Event::TitleChanged);
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut this = Self {
|
let mut this = Self {
|
||||||
handle: cx.weak_handle(),
|
handle: cx.weak_handle(),
|
||||||
buffer: buffer.clone(),
|
buffer: buffer.clone(),
|
||||||
@ -1304,6 +1314,11 @@ impl Editor {
|
|||||||
cx.observe_global::<Settings, _>(Self::settings_changed),
|
cx.observe_global::<Settings, _>(Self::settings_changed),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(project_subscription) = project_subscription {
|
||||||
|
this._subscriptions.push(project_subscription);
|
||||||
|
}
|
||||||
|
|
||||||
this.end_selection(cx);
|
this.end_selection(cx);
|
||||||
this.scroll_manager.show_scrollbar(cx);
|
this.scroll_manager.show_scrollbar(cx);
|
||||||
|
|
||||||
|
@ -2973,7 +2973,7 @@ impl BackgroundScanner {
|
|||||||
fs_entry.is_ignored = ignore_stack.is_all();
|
fs_entry.is_ignored = ignore_stack.is_all();
|
||||||
snapshot.insert_entry(fs_entry, self.fs.as_ref());
|
snapshot.insert_entry(fs_entry, self.fs.as_ref());
|
||||||
|
|
||||||
self.reload_repo_for_path(&path, &mut snapshot);
|
self.reload_repo_for_path(&path, &mut snapshot, self.fs.as_ref());
|
||||||
|
|
||||||
if let Some(scan_queue_tx) = &scan_queue_tx {
|
if let Some(scan_queue_tx) = &scan_queue_tx {
|
||||||
let mut ancestor_inodes = snapshot.ancestor_inodes_for_path(&path);
|
let mut ancestor_inodes = snapshot.ancestor_inodes_for_path(&path);
|
||||||
@ -3030,7 +3030,7 @@ impl BackgroundScanner {
|
|||||||
Some(())
|
Some(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reload_repo_for_path(&self, path: &Path, snapshot: &mut LocalSnapshot) -> Option<()> {
|
fn reload_repo_for_path(&self, path: &Path, snapshot: &mut LocalSnapshot, fs: &dyn Fs) -> Option<()> {
|
||||||
let scan_id = snapshot.scan_id;
|
let scan_id = snapshot.scan_id;
|
||||||
|
|
||||||
if path
|
if path
|
||||||
@ -3038,7 +3038,14 @@ impl BackgroundScanner {
|
|||||||
.any(|component| component.as_os_str() == *DOT_GIT)
|
.any(|component| component.as_os_str() == *DOT_GIT)
|
||||||
{
|
{
|
||||||
let (entry_id, repo_ptr) = {
|
let (entry_id, repo_ptr) = {
|
||||||
let (entry_id, repo) = snapshot.repo_for_metadata(&path)?;
|
let Some((entry_id, repo)) = snapshot.repo_for_metadata(&path) else {
|
||||||
|
let dot_git_dir = path.ancestors()
|
||||||
|
.skip_while(|ancestor| ancestor.file_name() != Some(&*DOT_GIT))
|
||||||
|
.next()?;
|
||||||
|
|
||||||
|
snapshot.build_repo(dot_git_dir.into(), fs);
|
||||||
|
return None;
|
||||||
|
};
|
||||||
if repo.full_scan_id == scan_id {
|
if repo.full_scan_id == scan_id {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user