From 0fe631ea7cda5b2c1e5ad73e2a83a0770a57e1bf Mon Sep 17 00:00:00 2001 From: Claudia Date: Wed, 2 Jan 2019 17:45:43 +0100 Subject: [PATCH] Make `bash-it reload` preserve working directory In e5b6869 (part of #1283), a regression was introduced, which caused `bash-it reload` to return with the working directory set to `.bash_it` and the original working directory discarded. The root cause is the function wrapper of `bash-it reload`, which has always relied on the working directory not to change during execution of the wrapped code. This assumption no longer holds with the changes introduced in #1283. This commit fixes the regression by using `pushd`/`popd` in `bash-it reload`. --- lib/helpers.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index e632b80b..4d11e657 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -256,7 +256,7 @@ _bash-it-reload() { _about 'reloads a profile file' _group 'lib' - cd "${BASH_IT}" || return + pushd "${BASH_IT}" &> /dev/null || return case $OSTYPE in darwin*) @@ -267,7 +267,7 @@ _bash-it-reload() { ;; esac - cd - &> /dev/null || return + popd &> /dev/null || return } _bash-it-describe ()