This prevents issues where autoenv scripts use $0. When a shell enters the directory holding the autoenv scripts, it works as expected with $0 being the path to the symlink. However, if the shell enters one of its child directories the path to the script is dereferenced, and $0 is instead the path to the symlink's target.
From `man 1 zshexpn`:
> A – Turn a file name into an absolute path as the 'a' modifier does, and then pass the result through the realpath(3) library function to resolve symbolic links.
Note: Symlinks are dereferenced elsewhere for authorization, so that behavior is unchanged.
- check that VIRTUAL_ENV is non-empty, which might happen when
`deactivate` was called already.
- perform directory name abbreviation on the virtualenv path.
A new parameter is added to `_autoenv_hash_pair` to specify the version, defaulting to the latest (2). It outputs a `cksum`-based hash for version 2 and `shasum`-based for version 1.
Moves logic to check for an entry in `$AUTOENV_AUTH_FILE` into its own function (`_autoenv_authorized_pair`), as it may need to be called twice.
Modifies `_autoenv_authorized_env_file` to check for v1 entries when v2 fails.
Fixes#53. Alternative implementation to #54.
I have noticed that `autostash` called an (accidentally)
defined/overwritten `stash` function.
While it's not possible to put this into a local scope, this will at
least make it less polluting by default (when autostashing is not used).
Additionally we could source it always (not just once), but then it
would only re-overwrite the function.
A better fix would be to prefix the functions explicitly, e.g.
`autoenv_autostash` etc.
Closes https://github.com/Tarrasch/zsh-autoenv/pull/42.
The variables are local now, which makes them being handled correctly
when calling `autoenv_source_parent`.
Without this, a call to `autoenv_source_parent` overwrites the values in
the current scope.
stdout might be redirected, e.g. with "cd - >/dev/null", and this
message should appear in stderr probably anyway.
I've tried to add a test for this, by redirecting stdout in .zshenv, but
cram does not handle this well (and appears to redirect stderr to stdout
anyway).
The globals are not necessary and can cause problems with
AUTO_NAME_DIRS.
- Use funcsourcetrace[1] instead of _autoenv_source_dir.
- Use OLDPWD instead of _autoenv_chpwd_prev_dir.
Fixes#33.