From cb1a32507f3aa34b027f9d4710cdee3ba6fb97b8 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Mon, 1 Jun 2020 00:00:00 -0400 Subject: [PATCH] Fix portability to Bash GNU Bash, unlike mksh, do not consider "cd /path/to/regular/file/.." and "cd /path/to/regular" equivalent, and complains about regular file not being directory instead. --- forge-link | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/forge-link b/forge-link index 16417cb..48cd9d9 100755 --- a/forge-link +++ b/forge-link @@ -22,7 +22,8 @@ if [ ! -e "${file}" ]; then exit 1 fi -cd "${file}/.." +containing_dir=$(dirname "${file}") +cd "${containing_dir}" gitroot=$(git rev-parse --show-toplevel) abspath=$(realpath "${file}") relpath=${abspath##${gitroot}} -- 2.45.2