tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] taurignore excluding all file except for few of crate excludes entire crate not working

Open anatawa12 opened this issue 1 year ago • 4 comments

Describe the bug

taurignore excluding all file except for few of crate excludes entire crate

# everuthing except for rust files
/*
!/*.toml
!/*.rs
!/icons
!/src

at crate root should not ignore files in src folder but tauri cli does not watch entire crate

I confirmed this configuration works with gitignore so I think this is a bug in tauri.

I reproducible with both tauri cli v1.5.10 and v1.5.11.

Reproduction

https://github.com/anatawa12/tauri-issue-9163

run cargo tauri dev will not show

        Info Watching /Users/anatawa12/RustroverProjects/tauri-issue-9163 for changes...

When I replaced IgnoreMatcher::is_ignore with the following code

  fn is_ignore(&self, path: &Path, is_dir: bool) -> bool {
    for gitignore in &self.0 {
      if path.starts_with(gitignore.path())
      {
        let parents = gitignore.matched(path, is_dir);
        if parents.is_ignore() {
          println!("ignore: {:?}", parents);
          return true;
        }
      }
    }
    false
  }

shows the following message.

$ cargo tauri dev
     Running BeforeDevCommand (`:`)
ignore: Ignore(Glob { from: Some("/Users/anatawa12/RustroverProjects/tauri-issue-9163/.taurignore"), original: "/*", actual: "*", is_whitelist: false, is_only_dir: false })
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s

Expected behavior

taurignore excluding all file except for few should not exclude folder from watching.

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.3.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.75.0 (82e1608df 2023-12-21)
    ✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 20.10.0
    - pnpm: 8.15.3
    - yarn: 1.22.19
    - npm: 10.2.3

[-] Packages
    - tauri [RUST]: 1.6.1
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.7
    - tauri-cli [RUST]: 1.5.12-beta.2
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 1.5.11

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: out
    - devPath: http://localhost:3000/
    - framework: React (Next.js)
    - bundler: Webpack

Stack trace

No response

Additional context

Gitignore::matched and Gitignore::matched_path_or_any_parents returns Ignore(Glob{original:"/*"}) for the folder contains .gitignore file.

anatawa12 avatar Mar 12 '24 13:03 anatawa12

Since tauri-cli pass is_dir = true to ignore crate, I think this might be a bug of ignore

anatawa12 avatar Mar 12 '24 13:03 anatawa12

can confirm this is also an issue with the latest version of the cli beta v2.0.0-beta.11

Alt-iOS avatar Mar 26 '24 07:03 Alt-iOS

can confirm this is also an issue with the latest version of the cli beta v2.0.0-beta.11

Yes.

bash-3.2$ cargo tauri --version
tauri-cli 2.0.0-beta.11
bash-3.2$ cat .taurignore 
/*
!/src
!/*.toml
!/*.rs
bash-3.2$ cargo tauri dev
    Running BeforeDevCommand (`:`)
    Finished dev [unoptimized + debuginfo] target(s) in 0.31s
^Cbash-3.2$ 
bash-3.2$ cargo tauri --version
tauri-cli 2.0.0-beta.11
bash-3.2$ cat .taurignore 
#/*
!/src
!/*.toml
!/*.rs
bash-3.2$ cargo tauri dev
    Running BeforeDevCommand (`:`)
    Info Watching /Users/anatawa12/RustroverProjects/tauri-issue-9163 for changes...
    Finished dev [unoptimized + debuginfo] target(s) in 0.47s
^Cbash-3.2$ 

anatawa12 avatar Mar 26 '24 07:03 anatawa12

Sorry, I meant is as I can confirm this is also an issue, as I am also having it with the newest beta haha, didnt mean it as a question

Alt-iOS avatar Mar 26 '24 08:03 Alt-iOS