diff --git a/rust/hg-core/src/sparse.rs b/rust/hg-core/src/sparse.rs --- a/rust/hg-core/src/sparse.rs +++ b/rust/hg-core/src/sparse.rs @@ -282,7 +282,7 @@ pub fn matcher( 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 @@ pub fn matcher( 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)); diff --git a/tests/test-sparse.t b/tests/test-sparse.t --- a/tests/test-sparse.t +++ b/tests/test-sparse.t @@ -21,6 +21,29 @@ test sparse 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