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
--- 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,
--- 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