worktree: Add some info-level logging about added and removed repository entries (#26291)
Trying to track down a user's reported issue with parent repositories not getting picked up. Release Notes: - N/A
This commit is contained in:
parent
80fb88520f
commit
b0b0b00fae
1 changed files with 18 additions and 9 deletions
|
@ -3424,6 +3424,7 @@ impl BackgroundScannerState {
|
|||
}
|
||||
|
||||
fn remove_path(&mut self, path: &Path) {
|
||||
log::info!("background scanner removing path {path:?}");
|
||||
let mut new_entries;
|
||||
let removed_entries;
|
||||
{
|
||||
|
@ -3479,7 +3480,14 @@ impl BackgroundScannerState {
|
|||
.git_repositories
|
||||
.retain(|id, _| removed_ids.binary_search(id).is_err());
|
||||
self.snapshot.repositories.retain(&(), |repository| {
|
||||
!repository.work_directory.path_key().0.starts_with(path)
|
||||
let retain = !repository.work_directory.path_key().0.starts_with(path);
|
||||
if !retain {
|
||||
log::info!(
|
||||
"dropping repository entry for {:?}",
|
||||
repository.work_directory
|
||||
);
|
||||
}
|
||||
retain
|
||||
});
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -3534,12 +3542,14 @@ impl BackgroundScannerState {
|
|||
fs: &dyn Fs,
|
||||
watcher: &dyn Watcher,
|
||||
) -> Option<LocalRepositoryEntry> {
|
||||
log::info!("insert git reposiutory for {dot_git_path:?}");
|
||||
let work_dir_id = self
|
||||
.snapshot
|
||||
.entry_for_path(work_directory.path_key().0)
|
||||
.map(|entry| entry.id)?;
|
||||
|
||||
if self.snapshot.git_repositories.get(&work_dir_id).is_some() {
|
||||
log::info!("existing git repository for {work_directory:?}");
|
||||
return None;
|
||||
}
|
||||
|
||||
|
@ -3547,6 +3557,7 @@ impl BackgroundScannerState {
|
|||
|
||||
let t0 = Instant::now();
|
||||
let repository = fs.open_repo(&dot_git_abs_path)?;
|
||||
log::info!("opened git repo for {dot_git_abs_path:?}");
|
||||
|
||||
let repository_path = repository.path();
|
||||
watcher.add(&repository_path).log_err()?;
|
||||
|
@ -3605,6 +3616,7 @@ impl BackgroundScannerState {
|
|||
.git_repositories
|
||||
.insert(work_dir_id, local_repository.clone());
|
||||
|
||||
log::info!("inserting new local git repository");
|
||||
Some(local_repository)
|
||||
}
|
||||
}
|
||||
|
@ -4352,7 +4364,7 @@ impl BackgroundScanner {
|
|||
}
|
||||
|
||||
let ancestor_dot_git = ancestor.join(*DOT_GIT);
|
||||
log::debug!("considering ancestor: {ancestor_dot_git:?}");
|
||||
log::info!("considering ancestor: {ancestor_dot_git:?}");
|
||||
// Check whether the directory or file called `.git` exists (in the
|
||||
// case of worktrees it's a file.)
|
||||
if self
|
||||
|
@ -4361,7 +4373,6 @@ impl BackgroundScanner {
|
|||
.await
|
||||
.is_ok_and(|metadata| metadata.is_some())
|
||||
{
|
||||
log::debug!(".git path exists");
|
||||
if index != 0 {
|
||||
// We canonicalize, since the FS events use the canonicalized path.
|
||||
if let Some(ancestor_dot_git) =
|
||||
|
@ -4372,7 +4383,7 @@ impl BackgroundScanner {
|
|||
.strip_prefix(ancestor)
|
||||
.unwrap()
|
||||
.into();
|
||||
log::debug!(
|
||||
log::info!(
|
||||
"inserting parent git repo for this worktree: {location_in_repo:?}"
|
||||
);
|
||||
// We associate the external git repo with our root folder and
|
||||
|
@ -4395,12 +4406,10 @@ impl BackgroundScanner {
|
|||
|
||||
// Reached root of git repository.
|
||||
break;
|
||||
} else {
|
||||
log::debug!(".git path doesn't exist");
|
||||
}
|
||||
}
|
||||
|
||||
log::debug!("containing git repository: {containing_git_repository:?}");
|
||||
log::info!("containing git repository: {containing_git_repository:?}");
|
||||
|
||||
let (scan_job_tx, scan_job_rx) = channel::unbounded();
|
||||
{
|
||||
|
@ -4825,7 +4834,7 @@ impl BackgroundScanner {
|
|||
log::error!("skipping excluded directory {:?}", job.path);
|
||||
return Ok(());
|
||||
}
|
||||
log::debug!("scanning directory {:?}", job.path);
|
||||
log::info!("scanning directory {:?}", job.path);
|
||||
root_abs_path = snapshot.abs_path().clone();
|
||||
root_char_bag = snapshot.root_char_bag;
|
||||
}
|
||||
|
@ -5407,7 +5416,7 @@ impl BackgroundScanner {
|
|||
}
|
||||
|
||||
fn update_git_repositories(&self, dot_git_paths: Vec<PathBuf>) -> Task<()> {
|
||||
log::debug!("reloading repositories: {dot_git_paths:?}");
|
||||
log::info!("reloading repositories: {dot_git_paths:?}");
|
||||
|
||||
let mut status_updates = Vec::new();
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue