Commit Graph

11 Commits

Author SHA1 Message Date
Thomas Otto
f5b37173fe Don't read git files when --no-gitconfig is given + unused variables (#1728)
* Fix unused variables

* Don't read git files when --no-gitconfig is given

Despite starting delta with `--no-gitconfig`, strace still shows
that `.git/config` etc. files are accessed. By no longer doing
that it is very clear that no config options are read from there.
2024-06-24 13:26:28 -04:00
Thomas Otto
711353b4dd tests: prevent parallel env var access (#1681)
`env::set_var` is not-yet-unsafe, and here tests fail
because a var is already set by a second test while the first one
is still running.

`cargo test -- test_env` with sufficient (auto detected) parallelism
triggers this.
2024-05-04 09:45:37 -04:00
Dan Davison
a48a368b42 Add assertion failure message (#1508) 2023-08-12 20:54:57 -04:00
ippsav
3c55764215 Fix issue where pager would be set to more or most (#1494)
fix pager env in case of `more/most`
2023-07-29 19:25:02 -04:00
William Escande
85a07cd109 Add custom env struct to store env at init (#1025)
This allow to no longer ignore some tests (marked previously as FIXME)
by storing the env at the start of the program (Or creating a custom env
for test purpose)
This centralize almost alls calls to std::env inside one wrapper

Add a test profile to increase speed for testing (5min -> 20sec on my
machine)

clean a few code style like this:
```
if Some(value) = ...
    if value
```
to
```
if Some(true) = ...
```

Co-authored-by: William Escande <wescande@google.com>
2022-03-30 20:35:10 -04:00
Dan Davison
ab278a77fb Avoid using environment variables during tests 2021-12-12 17:36:56 -05:00
Marco Ieni
3dac4f7fa6 fix some clippy warnings (#380) 2020-11-05 18:12:27 -05:00
Dan Davison
2efb9d5c11 Interpret an env var as boolean false iff it is unset
If it is set to any value, including "" (and of course "false") then
it is true.

This matches the semantics which clap seems likely to adopt:
https://github.com/clap-rs/clap/issues/1476#issuecomment-652344026
2020-09-03 09:53:42 -04:00
Dan Davison
8f88b5b1eb Hack: env var for boolean flag
The proper way would be using env = "DELTA_NAVIGATE", but see
https://github.com/clap-rs/clap/issues/1476
https://github.com/TeXitoi/structopt/issues/372

Doing it as in this commit probably has drawbacks, e.g. related to
whether the argument is recorded as having been supplied.
2020-09-03 09:51:32 -04:00
Dan Davison
344355e028 Change variable name 2020-09-03 09:49:22 -04:00
Dan Davison
fa14a6b144 Add env module 2019-10-29 20:03:19 -07:00