[PATCH 1/4] dim: Move dim-last-path path definition to a variable
Maxime Ripard
maxime at cerno.tech
Thu Jan 13 08:43:49 UTC 2022
The code has multiple places where the .dim-last-path file is
referenced, so let's move it to a variable.
Signed-off-by: Maxime Ripard <maxime at cerno.tech>
---
bash_completion | 4 +++-
dim | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/bash_completion b/bash_completion
index e88aa4f98f2d..764993ba7472 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1,9 +1,11 @@
#! /bin/bash
+dim_last_path_file=~/.dim-last-path
+
dim ()
{
if [[ "$1" = "cd" ]]; then
- cd $(cat ~/.dim-last-path) || exit
+ cd $(cat $dim_last_path_file) || exit
else
command dim "$@"
fi
diff --git a/dim b/dim
index bbe9308ac695..865b2cb161b7 100755
--- a/dim
+++ b/dim
@@ -102,6 +102,8 @@ dim_pull_request_recipients=(
# integration configuration
dim_integration_config=nightly.conf
+dim_last_path_file=~/.dim-last-path
+
dim_extract_tags_marker="# *** extracted tags ***"
#
@@ -1516,7 +1518,7 @@ function dim_magic_patch
local conflict_files
if [[ "$1" = "-a" ]]; then
- cd $(cat ~/.dim-last-path)
+ cd $(cat $dim_last_path_file)
fi
conflict_files=$(patch -p1 | grep "saving rejects" | sed -e "s/.*saving rejects to file \(.*\)/\1/")
@@ -1617,7 +1619,7 @@ function dim_cd
path=$DIM_PREFIX/$DIM_REPO
fi
- echo $path > ~/.dim-last-path
+ echo $path > $dim_last_path_file
cd $path
}
--
2.34.1
More information about the dim-tools
mailing list