# HG changeset patch # User Raphaël Gomès # Date 1587628778 -7200 # Node ID a467416c493c3ab32f214b69b5d5831da24e5732 # Parent d8b703b8bf70908b27cfd607b2e77317fdf4fb30 rust-status: check for '.hg' regardless of file type (issue6300) '.hg' would show up in `hg status` if were a symlink. Differential Revision: https://phab.mercurial-scm.org/D8461 diff -r d8b703b8bf70 -r a467416c493c rust/hg-core/src/dirstate/status.rs --- a/rust/hg-core/src/dirstate/status.rs Mon Apr 20 11:03:31 2020 +0200 +++ b/rust/hg-core/src/dirstate/status.rs Thu Apr 23 09:59:38 2020 +0200 @@ -323,6 +323,11 @@ let file_type = dir_entry.file_type()?; let entry_option = dmap.get(&filename); + if filename.as_bytes() == b".hg" { + // Could be a directory or a symlink + return Ok(()); + } + if file_type.is_dir() { handle_traversed_dir( scope, @@ -446,9 +451,7 @@ options: StatusOptions, ) -> IoResult<()> { let directory = directory.as_ref(); - if directory.as_bytes() == b".hg" { - return Ok(()); - } + let visit_entries = match matcher.visit_children_set(directory) { VisitChildrenSet::Empty => return Ok(()), VisitChildrenSet::This | VisitChildrenSet::Recursive => None, diff -r d8b703b8bf70 -r a467416c493c tests/test-status.t --- a/tests/test-status.t Mon Apr 20 11:03:31 2020 +0200 +++ b/tests/test-status.t Thu Apr 23 09:59:38 2020 +0200 @@ -672,3 +672,11 @@ $ cd .. + +Make sure .hg doesn't show up even as a symlink + + $ hg init repo0 + $ mkdir symlink-repo0 + $ cd symlink-repo0 + $ ln -s ../repo0/.hg + $ hg status