[Updated] D8461: rust-status: check for '.hg' regardless of file type (issue6300)
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Thu Apr 23 08:02:45 UTC 2020
Alphare updated this revision to Diff 21182.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8461?vs=21162&id=21182
BRANCH
stable
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8461/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8461
AFFECTED FILES
rust/hg-core/src/dirstate/status.rs
tests/test-status.t
CHANGE DETAILS
diff --git a/tests/test-status.t b/tests/test-status.t
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -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
diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs
--- a/rust/hg-core/src/dirstate/status.rs
+++ b/rust/hg-core/src/dirstate/status.rs
@@ -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,
To: Alphare, #hg-reviewers, marmoute
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200423/0b8c5b59/attachment-0002.html>
More information about the Mercurial-patches
mailing list