feat(git-bulk): Add compatibility to match workspaces using environnement variable #1191
+8
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
With the current implementation of
git-bulk
(df53711
at the time of writing), using environment variables inside the~/.gitconfig
file to specify abulk
workspace works partially.For example, let's say that
$MYWORKSPACE
is set to~/myworkspace
.Let's say we use the following configuration in
~/.gitconfig
:[bulkworkspaces] myworkspace = $MYWORKSPACE
Next, what currently is working is the following command, using
status
as a demo command to testgit-bulk
:But what is not working is the following:
However, it is expected to either work or not work in the both situations.
Rationale
I think it would be a good feature to have it working in both situations.
In this way, it would allow to easily use the same workspace name with different paths for different hosts, for example.
Solution
In the function that test whether our shell
$PWD
is in a workspace or not, I simply dereference variable values if there is any and I use therealpath
of both$PWD
and the workspace directory.In addition to enabling full usage of environnement variable, this allows to match a workspace directory even if there is a mismatch between our
$PWD
and the workspace directory because of a symlink.