Mercurial > hg
changeset 50821:28c0fcff24e5 stable
rhg: fix the bug where sparse config is interpreted as relglob instead of glob
relglob apparently (in contrast with relpath) matches everywhere in the tree,
whereas glob only matches at the root.
The python version interprets these patterns as "glob" (see
"normalize(include, b'glob', ...)" in match.py)
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Thu, 10 Aug 2023 19:00:19 +0100 |
parents | 9ed281bbf864 |
children | 181936ad069a |
files | rust/hg-core/src/sparse.rs tests/test-sparse.t |
diffstat | 2 files changed, 25 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/sparse.rs Mon Aug 07 23:12:02 2023 +0200 +++ b/rust/hg-core/src/sparse.rs Thu Aug 10 19:00:19 2023 +0100 @@ -282,7 +282,7 @@ let (patterns, subwarnings) = parse_pattern_file_contents( &config.includes, Path::new(""), - Some(b"relglob:".as_ref()), + Some(b"glob:".as_ref()), false, )?; warnings.extend(subwarnings.into_iter().map(From::from)); @@ -292,7 +292,7 @@ let (patterns, subwarnings) = parse_pattern_file_contents( &config.excludes, Path::new(""), - Some(b"relglob:".as_ref()), + Some(b"glob:".as_ref()), false, )?; warnings.extend(subwarnings.into_iter().map(From::from));
--- a/tests/test-sparse.t Mon Aug 07 23:12:02 2023 +0200 +++ b/tests/test-sparse.t Thu Aug 10 19:00:19 2023 +0100 @@ -21,6 +21,29 @@ Verify basic --include $ hg up -q 0 + +Test that sparse pattern by default is interpreted as "glob:", and is interpreted relative to the root. + + $ hg debugsparse --reset + $ hg debugsparse -X 'foo*bar' + $ cat .hg/sparse + [exclude] + foo*bar + + $ mk() { mkdir -p "$1"; touch "$1"/"$2"; } + $ mk 'foo' bar + $ mk 'foo-bar' x + $ mk 'unanchoredfoo-bar' x + $ mk 'foo*bar' x + $ mk 'dir/foo-bar' x + $ hg status --config rhg.on-unsupported=abort + ? dir/foo-bar/x + ? foo/bar + ? unanchoredfoo-bar/x + $ hg clean -a --no-confirm + $ rm -r foo*bar + $ hg debugsparse --reset + $ hg debugsparse --include 'hide' $ ls -A .hg