mirror of
https://github.com/facebook/sapling.git
synced 2024-10-16 19:57:18 +03:00
7d346e6bc2
Summary: Change the Rust ignore matcher to accept an extra list of gitignore files. Parse "git:" entries of "ui.ignore" to be git ignore files. Reviewed By: DurhamG Differential Revision: D8863905 fbshipit-source-id: 0cd5e29e01f01496ff61c81b89f7876202f18a98
165 lines
2.7 KiB
Perl
165 lines
2.7 KiB
Perl
#require no-fsmonitor
|
|
$ python -c 'from mercurial.dirstate import rootcache' || exit 80
|
|
|
|
Load commonly used test logic
|
|
$ . "$TESTDIR/hggit/testutil"
|
|
|
|
$ hg init
|
|
|
|
We should only read .gitignore files in a hg-git repo (i.e. one with .hg/git
|
|
directory) otherwise, a rogue .gitignore could slow down a hg-only repo
|
|
|
|
$ mkdir .hg/git
|
|
|
|
$ touch foo
|
|
$ touch foobar
|
|
$ touch bar
|
|
$ echo 'foo*' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? bar
|
|
|
|
$ echo '*bar' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? foo
|
|
|
|
$ mkdir dir
|
|
$ touch dir/foo
|
|
$ echo 'foo' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? bar
|
|
? foobar
|
|
|
|
$ echo '/foo' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? bar
|
|
? dir/foo
|
|
? foobar
|
|
|
|
$ rm .gitignore
|
|
$ echo 'foo' > dir/.gitignore
|
|
$ hg status
|
|
? bar
|
|
? dir/.gitignore
|
|
? foo
|
|
? foobar
|
|
|
|
$ touch dir/bar
|
|
$ echo 'bar' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? dir/.gitignore
|
|
? foo
|
|
? foobar
|
|
|
|
$ echo '/bar' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? dir/.gitignore
|
|
? dir/bar
|
|
? foo
|
|
? foobar
|
|
|
|
$ echo 'foo*' > .gitignore
|
|
$ echo '!*bar' >> .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? bar
|
|
? dir/.gitignore
|
|
? dir/bar
|
|
? foobar
|
|
|
|
$ echo '.hg/' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? bar
|
|
? dir/.gitignore
|
|
? dir/bar
|
|
? foo
|
|
? foobar
|
|
|
|
$ echo 'dir/.hg/' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? bar
|
|
? dir/.gitignore
|
|
? dir/bar
|
|
? foo
|
|
? foobar
|
|
|
|
$ echo '.hg/foo' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? bar
|
|
? dir/.gitignore
|
|
? dir/bar
|
|
? foo
|
|
? foobar
|
|
|
|
$ touch foo.hg
|
|
$ echo 'foo.hg' > .gitignore
|
|
$ hg status
|
|
? .gitignore
|
|
? bar
|
|
? dir/.gitignore
|
|
? dir/bar
|
|
? foo
|
|
? foobar
|
|
$ rm foo.hg
|
|
|
|
$ touch .hgignore
|
|
$ hg status
|
|
? .gitignore
|
|
? .hgignore
|
|
? bar
|
|
? dir/.gitignore
|
|
? dir/bar
|
|
? foo
|
|
? foobar
|
|
|
|
$ echo 'syntax: re' > .hgignore
|
|
$ echo 'foo.*$(?<!bar)' >> .hgignore
|
|
$ echo 'dir/foo' >> .hgignore
|
|
$ hg status
|
|
? .gitignore
|
|
? .hgignore
|
|
? bar
|
|
? dir/.gitignore
|
|
? dir/bar
|
|
? foobar
|
|
|
|
$ hg add .gitignore
|
|
$ hg commit -m "add and commit .gitignore"
|
|
$ rm .gitignore
|
|
$ rm .hgignore
|
|
$ hg status
|
|
! .gitignore
|
|
? bar
|
|
? dir/.gitignore
|
|
? dir/bar
|
|
? foo
|
|
? foobar
|
|
|
|
show pattern error in hgignore file as expected (issue197)
|
|
----------------------------------------------------------
|
|
|
|
$ cat > $TESTTMP/invalidhgignore <<EOF
|
|
> # invalid syntax in regexp
|
|
> foo(
|
|
> syntax: re
|
|
> EOF
|
|
$ hg status --config ui.ignore=$TESTTMP/invalidhgignore
|
|
abort: $TESTTMP/invalidhgignore: invalid pattern (relre): foo(
|
|
[255]
|
|
|
|
$ cat > .hgignore <<EOF
|
|
> # invalid syntax in regexp
|
|
> foo(
|
|
> EOF
|
|
$ hg status
|
|
abort: $TESTTMP/.hgignore: invalid pattern (relre): foo(
|
|
[255]
|