Repository: eza-community/eza (language: rust)

Issue:
bug: Cannot build the package without git feature
If eza does something unexpected, or its output looks wrong, or it displays an error on the screen, or if it outright crashes, then please include the following information in your report:

- The version of eza being used (`eza --version`)

latest master

- The command-line arguments you are using

:heavy_minus_sign: 

- Your operating system and hardware platform

```
OS: NixOS 23.11.20231128.7c4c205 (Tapir) x86_64
Kernel: 6.1.62
```

If it’s a crash, please include the full text of the crash that gets printed to the screen. If you’re seeing unexpected behaviour, a screenshot of the issue will help a lot.

---

```
➜ cargo run --bin eza --no-default-features                                                                                                                                                                                                                                                                  nix-shell-env
   Compiling eza v0.16.2 (/home/jan/repos/eza)
error[E0433]: failed to resolve: use of undeclared crate or module `git2`
   --> src/main.rs:230:18
    |
230 |             .map(git2::Repository::open)
    |                  ^^^^ use of undeclared crate or module `git2`
    |
help: there is a crate or module with a similar name
    |
230 |             .map(git::Repository::open)
    |                  ~~~

For more information about this error, try `rustc --explain E0433`.
error: could not compile `eza` (bin "eza") due to previous error
```


Discussion / hints:

Fix patch:
diff --git a/src/main.rs b/src/main.rs
index 851261e94..c5522ef55 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -191,6 +191,12 @@ fn git_options(options: &Options, args: &[&OsStr]) -> Option<GitCache> {
     }
 }
 
+#[cfg(not(feature = "git"))]
+fn git_repos(_options: &Options, _args: &[&OsStr]) -> bool {
+    return false;
+}
+
+#[cfg(feature = "git")]
 fn get_files_in_dir(paths: &mut Vec<PathBuf>, path: PathBuf) {
     let temp_paths = if path.is_dir() {
         path.read_dir()
@@ -203,6 +209,7 @@ fn get_files_in_dir(paths: &mut Vec<PathBuf>, path: PathBuf) {
     paths.extend(temp_paths);
 }
 
+#[cfg(feature = "git")]
 fn git_repos(options: &Options, args: &[&OsStr]) -> bool {
     let option_enabled = match options.view.mode {
         Mode::Details(details::Options {


Test patch: