summaryrefslogtreecommitdiffstats
path: root/vendor/ignore/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/ignore/src
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/ignore/src')
-rw-r--r--vendor/ignore/src/default_types.rs78
-rw-r--r--vendor/ignore/src/dir.rs15
-rw-r--r--vendor/ignore/src/gitignore.rs11
-rw-r--r--vendor/ignore/src/overrides.rs1
-rw-r--r--vendor/ignore/src/types.rs12
-rw-r--r--vendor/ignore/src/walk.rs9
6 files changed, 88 insertions, 38 deletions
diff --git a/vendor/ignore/src/default_types.rs b/vendor/ignore/src/default_types.rs
index d4d7db35e..e6a3a8f37 100644
--- a/vendor/ignore/src/default_types.rs
+++ b/vendor/ignore/src/default_types.rs
@@ -16,18 +16,24 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("asciidoc", &["*.adoc", "*.asc", "*.asciidoc"]),
("asm", &["*.asm", "*.s", "*.S"]),
("asp", &[
- "*.aspx", "*.aspx.cs", "*.aspx.vb", "*.ascx", "*.ascx.cs", "*.ascx.vb",
+ "*.aspx", "*.aspx.cs", "*.aspx.vb", "*.ascx", "*.ascx.cs",
+ "*.ascx.vb", "*.asp"
]),
("ats", &["*.ats", "*.dats", "*.sats", "*.hats"]),
("avro", &["*.avdl", "*.avpr", "*.avsc"]),
("awk", &["*.awk"]),
- ("bazel", &["*.bazel", "*.bzl", "*.BUILD", "*.bazelrc", "BUILD", "WORKSPACE"]),
+ ("bazel", &[
+ "*.bazel", "*.bzl", "*.BUILD", "*.bazelrc", "BUILD", "MODULE.bazel",
+ "WORKSPACE", "WORKSPACE.bazel",
+ ]),
("bitbake", &["*.bb", "*.bbappend", "*.bbclass", "*.conf", "*.inc"]),
("brotli", &["*.br"]),
("buildstream", &["*.bst"]),
("bzip2", &["*.bz2", "*.tbz2"]),
("c", &["*.[chH]", "*.[chH].in", "*.cats"]),
("cabal", &["*.cabal"]),
+ ("candid", &["*.did"]),
+ ("carp", &["*.carp"]),
("cbor", &["*.cbor"]),
("ceylon", &["*.ceylon"]),
("clojure", &["*.clj", "*.cljc", "*.cljs", "*.cljx"]),
@@ -40,18 +46,21 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
"*.[ChH].in", "*.cc.in", "*.[ch]pp.in", "*.[ch]xx.in", "*.hh.in",
]),
("creole", &["*.creole"]),
- ("crystal", &["Projectfile", "*.cr"]),
+ ("crystal", &["Projectfile", "*.cr", "*.ecr", "shard.yml"]),
("cs", &["*.cs"]),
("csharp", &["*.cs"]),
("cshtml", &["*.cshtml"]),
("css", &["*.css", "*.scss"]),
("csv", &["*.csv"]),
+ ("cuda", &["*.cu", "*.cuh"]),
("cython", &["*.pyx", "*.pxi", "*.pxd"]),
("d", &["*.d"]),
("dart", &["*.dart"]),
+ ("devicetree", &["*.dts", "*.dtsi"]),
("dhall", &["*.dhall"]),
("diff", &["*.patch", "*.diff"]),
("docker", &["*Dockerfile*"]),
+ ("dts", &["*.dts", "*.dtsi"]),
("dvc", &["Dvcfile", "*.dvc"]),
("ebuild", &["*.ebuild"]),
("edn", &["*.edn"]),
@@ -60,6 +69,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("elm", &["*.elm"]),
("erb", &["*.erb"]),
("erlang", &["*.erl", "*.hrl"]),
+ ("fennel", &["*.fnl"]),
("fidl", &["*.fidl"]),
("fish", &["*.fish"]),
("flatbuffers", &["*.fbs"]),
@@ -68,24 +78,27 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
"*.f90", "*.F90", "*.f95", "*.F95",
]),
("fsharp", &["*.fs", "*.fsx", "*.fsi"]),
- ("fut", &[".fut"]),
+ ("fut", &["*.fut"]),
("gap", &["*.g", "*.gap", "*.gi", "*.gd", "*.tst"]),
("gn", &["*.gn", "*.gni"]),
("go", &["*.go"]),
("gradle", &["*.gradle"]),
("groovy", &["*.groovy", "*.gradle"]),
("gzip", &["*.gz", "*.tgz"]),
- ("h", &["*.h", "*.hpp"]),
+ ("h", &["*.h", "*.hh", "*.hpp"]),
("haml", &["*.haml"]),
+ ("hare", &["*.ha"]),
("haskell", &["*.hs", "*.lhs", "*.cpphs", "*.c2hs", "*.hsc"]),
("hbs", &["*.hbs"]),
("hs", &["*.hs", "*.lhs"]),
("html", &["*.htm", "*.html", "*.ejs"]),
+ ("hy", &["*.hy"]),
("idris", &["*.idr", "*.lidr"]),
+ ("janet", &["*.janet"]),
("java", &["*.java", "*.jsp", "*.jspx", "*.properties"]),
("jinja", &["*.j2", "*.jinja", "*.jinja2"]),
("jl", &["*.jl"]),
- ("js", &["*.js", "*.jsx", "*.vue"]),
+ ("js", &["*.js", "*.jsx", "*.vue", "*.cjs", "*.mjs"]),
("json", &["*.json", "composer.lock"]),
("jsonl", &["*.jsonl"]),
("julia", &["*.jl"]),
@@ -120,6 +133,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
"MPL-*[0-9]*",
"OFL-*[0-9]*",
]),
+ ("lilypond", &["*.ly", "*.ily"]),
("lisp", &["*.el", "*.jl", "*.lisp", "*.lsp", "*.sc", "*.scm"]),
("lock", &["*.lock", "package-lock.json"]),
("log", &["*.log"]),
@@ -135,14 +149,15 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
]),
("mako", &["*.mako", "*.mao"]),
("man", &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
- ("markdown", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]),
+ ("markdown", &["*.markdown", "*.md", "*.mdown", "*.mkd", "*.mkdn"]),
("matlab", &["*.m"]),
- ("md", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]),
+ ("md", &["*.markdown", "*.md", "*.mdown", "*.mkd", "*.mkdn"]),
("meson", &["meson.build", "meson_options.txt"]),
("minified", &["*.min.html", "*.min.css", "*.min.js"]),
("mint", &["*.mint"]),
("mk", &["mkfile"]),
("ml", &["*.ml"]),
+ ("motoko", &["*.mo"]),
("msbuild", &[
"*.csproj", "*.fsproj", "*.vcxproj", "*.proj", "*.props", "*.targets",
]),
@@ -152,16 +167,22 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("objcpp", &["*.h", "*.mm"]),
("ocaml", &["*.ml", "*.mli", "*.mll", "*.mly"]),
("org", &["*.org", "*.org_archive"]),
+ ("pants", &["BUILD"]),
("pascal", &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
("pdf", &["*.pdf"]),
("perl", &["*.perl", "*.pl", "*.PL", "*.plh", "*.plx", "*.pm", "*.t"]),
- ("php", &["*.php", "*.php3", "*.php4", "*.php5", "*.phtml"]),
+ ("php", &[
+ // note that PHP 6 doesn't exist
+ // See: https://wiki.php.net/rfc/php6
+ "*.php", "*.php3", "*.php4", "*.php5", "*.php7", "*.php8",
+ "*.pht", "*.phtml"
+ ]),
("po", &["*.po"]),
("pod", &["*.pod"]),
("postscript", &["*.eps", "*.ps"]),
("protobuf", &["*.proto"]),
("ps", &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]),
- ("puppet", &["*.erb", "*.pp", "*.rb"]),
+ ("puppet", &["*.epp", "*.erb", "*.pp", "*.rb"]),
("purs", &["*.purs"]),
("py", &["*.py"]),
("qmake", &["*.pro", "*.pri", "*.prf"]),
@@ -170,7 +191,9 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("racket", &["*.rkt"]),
("rdoc", &["*.rdoc"]),
("readme", &["README*", "*README"]),
+ ("reasonml", &["*.re", "*.rei"]),
("red", &["*.r", "*.red", "*.reds"]),
+ ("rescript", &["*.res", "*.resi"]),
("robot", &["*.robot"]),
("rst", &["*.rst"]),
("ruby", &[
@@ -208,6 +231,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("slim", &["*.skim", "*.slim", "*.slime"]),
("smarty", &["*.tpl"]),
("sml", &["*.sml", "*.sig"]),
+ ("solidity", &["*.sol"]),
("soy", &["*.soy"]),
("spark", &["*.spark"]),
("spec", &["*.spec"]),
@@ -225,11 +249,12 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("taskpaper", &["*.taskpaper"]),
("tcl", &["*.tcl"]),
("tex", &["*.tex", "*.ltx", "*.cls", "*.sty", "*.bib", "*.dtx", "*.ins"]),
+ ("texinfo", &["*.texi"]),
("textile", &["*.textile"]),
("tf", &["*.tf"]),
("thrift", &["*.thrift"]),
("toml", &["*.toml", "Cargo.lock"]),
- ("ts", &["*.ts", "*.tsx"]),
+ ("ts", &["*.ts", "*.tsx", "*.cts", "*.mts"]),
("twig", &["*.twig"]),
("txt", &["*.txt"]),
("typoscript", &["*.typoscript", "*.ts"]),
@@ -238,8 +263,12 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("vcl", &["*.vcl"]),
("verilog", &["*.v", "*.vh", "*.sv", "*.svh"]),
("vhdl", &["*.vhd", "*.vhdl"]),
- ("vim", &["*.vim"]),
- ("vimscript", &["*.vim"]),
+ ("vim", &[
+ "*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
+ ]),
+ ("vimscript", &[
+ "*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
+ ]),
("webidl", &["*.idl", "*.webidl", "*.widl"]),
("wiki", &["*.mediawiki", "*.wiki"]),
("xml", &[
@@ -262,3 +291,26 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
]),
("zstd", &["*.zst", "*.zstd"]),
];
+
+#[cfg(test)]
+mod tests {
+ use super::DEFAULT_TYPES;
+
+ #[test]
+ fn default_types_are_sorted() {
+ let mut names = DEFAULT_TYPES.iter().map(|(name, _exts)| name);
+
+ let Some(mut previous_name) = names.next() else { return; };
+
+ for name in names {
+ assert!(
+ name > previous_name,
+ r#""{}" should be sorted before "{}" in `DEFAULT_TYPES`"#,
+ name,
+ previous_name
+ );
+
+ previous_name = name;
+ }
+ }
+}
diff --git a/vendor/ignore/src/dir.rs b/vendor/ignore/src/dir.rs
index 09414e9a6..2577665d5 100644
--- a/vendor/ignore/src/dir.rs
+++ b/vendor/ignore/src/dir.rs
@@ -202,11 +202,12 @@ impl Ignore {
errs.maybe_push(err);
igtmp.is_absolute_parent = true;
igtmp.absolute_base = Some(absolute_base.clone());
- igtmp.has_git = if self.0.opts.git_ignore {
- parent.join(".git").exists()
- } else {
- false
- };
+ igtmp.has_git =
+ if self.0.opts.require_git && self.0.opts.git_ignore {
+ parent.join(".git").exists()
+ } else {
+ false
+ };
ig = Ignore(Arc::new(igtmp));
compiled.insert(parent.as_os_str().to_os_string(), ig.clone());
}
@@ -231,7 +232,9 @@ impl Ignore {
/// Like add_child, but takes a full path and returns an IgnoreInner.
fn add_child_path(&self, dir: &Path) -> (IgnoreInner, Option<Error>) {
- let git_type = if self.0.opts.git_ignore || self.0.opts.git_exclude {
+ let git_type = if self.0.opts.require_git
+ && (self.0.opts.git_ignore || self.0.opts.git_exclude)
+ {
dir.join(".git").metadata().ok().map(|md| md.file_type())
} else {
None
diff --git a/vendor/ignore/src/gitignore.rs b/vendor/ignore/src/gitignore.rs
index 7922651cb..3c7ba5e6b 100644
--- a/vendor/ignore/src/gitignore.rs
+++ b/vendor/ignore/src/gitignore.rs
@@ -474,10 +474,13 @@ impl GitignoreBuilder {
}
// If it ends with a slash, then this should only match directories,
// but the slash should otherwise not be used while globbing.
- if let Some((i, c)) = line.char_indices().rev().nth(0) {
- if c == '/' {
- glob.is_only_dir = true;
- line = &line[..i];
+ if line.as_bytes().last() == Some(&b'/') {
+ glob.is_only_dir = true;
+ line = &line[..line.len() - 1];
+ // If the slash was escaped, then remove the escape.
+ // See: https://github.com/BurntSushi/ripgrep/issues/2236
+ if line.as_bytes().last() == Some(&b'\\') {
+ line = &line[..line.len() - 1];
}
}
glob.actual = line.to_string();
diff --git a/vendor/ignore/src/overrides.rs b/vendor/ignore/src/overrides.rs
index d42d67ca2..e96b8e0b6 100644
--- a/vendor/ignore/src/overrides.rs
+++ b/vendor/ignore/src/overrides.rs
@@ -106,6 +106,7 @@ impl Override {
}
/// Builds a matcher for a set of glob overrides.
+#[derive(Clone, Debug)]
pub struct OverrideBuilder {
builder: GitignoreBuilder,
}
diff --git a/vendor/ignore/src/types.rs b/vendor/ignore/src/types.rs
index efb9a8d9b..616a8d217 100644
--- a/vendor/ignore/src/types.rs
+++ b/vendor/ignore/src/types.rs
@@ -122,10 +122,6 @@ enum GlobInner<'a> {
Matched {
/// The file type definition which provided the glob.
def: &'a FileTypeDef,
- /// The index of the glob that matched inside the file type definition.
- which: usize,
- /// Whether the selection was negated or not.
- negated: bool,
},
}
@@ -291,13 +287,9 @@ impl Types {
self.set.matches_into(name, &mut *matches);
// The highest precedent match is the last one.
if let Some(&i) = matches.last() {
- let (isel, iglob) = self.glob_to_selection[i];
+ let (isel, _) = self.glob_to_selection[i];
let sel = &self.selections[isel];
- let glob = Glob(GlobInner::Matched {
- def: sel.inner(),
- which: iglob,
- negated: sel.is_negated(),
- });
+ let glob = Glob(GlobInner::Matched { def: sel.inner() });
return if sel.is_negated() {
Match::Ignore(glob)
} else {
diff --git a/vendor/ignore/src/walk.rs b/vendor/ignore/src/walk.rs
index b381197ef..602faaec3 100644
--- a/vendor/ignore/src/walk.rs
+++ b/vendor/ignore/src/walk.rs
@@ -941,7 +941,7 @@ impl Walk {
// overheads; an example of this was a bespoke filesystem layer in
// Windows that hosted files remotely and would download them on-demand
// when particular filesystem operations occurred. Users of this system
- // who ensured correct file-type fileters were being used could still
+ // who ensured correct file-type filters were being used could still
// get unnecessary file access resulting in large downloads.
if should_skip_entry(&self.ig, ent) {
return Ok(true);
@@ -1282,7 +1282,7 @@ impl WalkParallel {
let quit_now = Arc::new(AtomicBool::new(false));
let num_pending =
Arc::new(AtomicUsize::new(stack.lock().unwrap().len()));
- crossbeam_utils::thread::scope(|s| {
+ std::thread::scope(|s| {
let mut handles = vec![];
for _ in 0..threads {
let worker = Worker {
@@ -1296,13 +1296,12 @@ impl WalkParallel {
skip: self.skip.clone(),
filter: self.filter.clone(),
};
- handles.push(s.spawn(|_| worker.run()));
+ handles.push(s.spawn(|| worker.run()));
}
for handle in handles {
handle.join().unwrap();
}
- })
- .unwrap(); // Pass along panics from threads
+ });
}
fn threads(&self) -> usize {