~kaction/forge-link

cb1a32507f3aa34b027f9d4710cdee3ba6fb97b8 — Dmitry Bogatov 4 years ago 4969480
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.
1 files changed, 2 insertions(+), 1 deletions(-)

M forge-link
M forge-link => forge-link +2 -1
@@ 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}}