From ac887f310f8bfddf19e647f54d9f5cd6bfd1e64c Mon Sep 17 00:00:00 2001 From: Felix Althaus Date: Sat, 20 May 2017 10:11:00 +0200 Subject: [PATCH] Make hg-fst-export.sh callable via a symbolic link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- hg-fast-export.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hg-fast-export.sh b/hg-fast-export.sh index 93342ee..1117cbd 100755 --- a/hg-fast-export.sh +++ b/hg-fast-export.sh @@ -3,7 +3,11 @@ # Copyright (c) 2007, 2008 Rocco Rutte and others. # License: MIT -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"