Make hg-fst-export.sh callable via a symbolic link

Calling hg-fast-export.sh via a symlink used to fail because the
script would look for hg-fast-export.py in the symlink‘s
directory. This patch adds symlink resolution using greadlink with a
fallback to readlink in order to support MacOS. That way you can
safely add a symlink to hg-fast-export.sh somewhere in you PATH.

Fixes https://github.com/frej/fast-export/issues/93
This commit is contained in:
Felix Althaus
2017-05-20 10:11:00 +02:00
committed by Frej Drejhammar
parent 4bb50bb3fb
commit ac887f310f

View File

@@ -3,7 +3,11 @@
# Copyright (c) 2007, 2008 Rocco Rutte <pdmef@gmx.net> and others.
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
ROOT="$(dirname "$(which "$0")")"
READLINK="readlink"
if command -v greadlink > /dev/null; then
READLINK="greadlink" # Prefer greadlink over readlink
fi
ROOT="$(dirname "$($READLINK -f "$(which "$0")")")"
REPO=""
PFX="hg2git"
SFX_MAPPING="mapping"