hyperupcall / autoenv

Directory-based environments.
MIT License
5.72k stars 261 forks source link

source AUTOENV_ENV_LEAVE_FILENAME files of the parent directories, wh… #211

Closed pashaosipyants closed 2 years ago

pashaosipyants commented 2 years ago

What I have?

/path/to/my/project/.env /path/to/my/project/.env.leave /path/to/my/project/src (project subdirectory)

cat /path/to/my/project/.env

export MY_VAR=AAA

cat /path/to/my/project/.env.leave

export MY_VAR=

What I do?

cd /path/to/my/project/src echo $MY_VAR

AAA

cd / echo $MY_VAR

AAA

What I expect?

cd /path/to/my/project/src echo $MY_VAR

AAA

cd / echo $MY_VAR

Summary

When leave happens out of a subdirectory of the directory containing .env.leave it is not sourced.

hyperupcall commented 2 years ago

Hai!,

Thanks for this fix! I was not aware of this bug

I'll merge this next week, in unison with some tests to ensure there aren't any regressions

pashaosipyants commented 2 years ago

@hyperupcall are any updates on those tests? awaiting this fix :)

hyperupcall commented 2 years ago

Yup! got it, thanks for the reminder :) The failing tests are due to a new testing suite I'm working on atm, so everything should still be good