* Git branch: read from HEAD on newly init repo
On a newly initialized git repo, there are no branches created until a
commit is made. Previously, starship handled this by having a default
branch "master" for when branch `head` could not be read.
However, if a user wants to set a different default branch name, that
name won't appear on starship until a commit is made to the branch.
If git2 provides a way to read the default branch name, we can use that,
but at the moment it's not obvious how.
For the moment, we can directly read `.git/HEAD`, which contains the
name of the default branch head reference. This commit implements this
strategy.
Closes#1327
* update git_branch test from unborn master to unborn default
* cargo fmt
Fixes git repo path contractions in two situations:
1. When path obtained from `PWD` is a logical path but git libraries
return physical paths.
2. When a git repository's subdirectory is symlinked to ouside of the
repository tree.
(1) is fixed by implementing a realpath()-like function, then reparsing
the (possibly logical) `PWD` using realpath() to convert logical
components into physical ones. The physical paths are then matched
against each other.
In the case of (2), the default behavior has been changed by simply
contracting to the home directory, exactly the same as if we are not in
a repo at all. Because determining the correct contraction is not
obvious, we bail out and just pretend we are not in a repo at all.
* Add option to change the python binary
We are going to start to have problems with the python binary as python2
is removed and replaced with python3. To make the transition easier I
have added an option to the python module to allow the user to pick a
particular binary, e.g `python3`, for the module to use when selecting
the version of python. I have also refactored the python tests moving
almost all of them into the module and removing the dependency on the
version of python that is installed on the system.
* Add advanced config section to python module docs
Have added an advanced config section to the python module docs and
moved the `python_binary` option into that section.
* Avoid confusing modules with PowerShell paths
* Avoid confusing modules with PowerShell paths
Powershell supports PSDrives (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-psdrive?view=powershell-7) that allow to create "logical" drives mapped to actual Windows drives.
* Preserve Windows directories
* Preserve logical paths for Powershell
* Fix formating with cargo fmt
* Fix directory_in_root test
Co-authored-by: Jean Gautier <jean.gautier@ssi.gouv.fr>
The user's config is automatically loaded
in context.new_module. This change explicitly
sets the empty config to avoid depending on
the environment.
Without this fix, the tests do not pass
for users who have a custom symbol defined
for conda. This prevents installing/upgrading
from Arch Linux AUR.
* Use AWS_VAULT as the profile if set
[aws-vault](https://github.com/99designs/aws-vault) sets
the `AWS_VAULT` env var instead of `AWS_PROFILE` when an
aws-vault session is active.
This PR adds support for reading the AWS profile value from
the `AWS_VAULT` env var, giving priority to `AWS_VAULT` if both
it and `AWS_PROFILE` are set.
* Update docs for AWS_VAULT
Replaces the existing nodejs module end-to-end tests with integration tests that don't require preinstalled environmental dependencies.
- Moved the tests to the same file as the module they test
- Created a render_module utility function for rendering modules within tests
- Removed Node.js installation during CI setup
- Add Shell to Context to allow for tests to not run shell-specific code
* ci: Replace setup-ruby with use-ruby-action
* ci: Update python version
* ci: Update Ruby version
* Set ruby action to master
* Try installing mercurial earlier in the workflow
* Remove mercurial installation
* Remove mercurial installation on all OSes
* Revert "Remove mercurial installation on all OSes"
This reverts commit 0e1a3e7e92.
* Update hg installation comment
* Revert Ruby update
* Add caching
* Add caching to audit
* Update workflow.yml
* Only cache during test steps
perf: don't use hg process to get branch / bookmark information, each call was taking 250ms and it was making on average 2 calls.
the branch and bookmark information is available in files in the root of the repo, use that instead.
now takes 300 micro seconds
fix: do not use .hgignore to decide if it is an hg repo. was providing false positives. #721
fix: after changing branch the new branch was not show (the old branch was shown), the new branch is now correctly shown. #722
fix: if no branch override was set it would say (no branch) however if you commited in that state you would commit to the branch default so say that instead
* Get pathbuf from logical path. (fixes#204)
(also fixes#397)
* fix: Update directory module so that use_logical_path will work properly
* Remove test directory::use_logical_and_physical_paths
* Fix merge errors
Co-authored-by: Matan Kushner <hello@matchai.me>