Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit 02bb982

Browse files
committed
Behave nicely when the found readlink does not understand '-f'
Instead of just crashing when the found readlink does not understand '-f', fall back to the pre ac887f3 behaviour and print an error message if we fail to find hg-fast-export.py.
1 parent c252e67 commit 02bb982

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

hg-fast-export.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@ READLINK="readlink"
77
if command -v greadlink > /dev/null; then
88
READLINK="greadlink" # Prefer greadlink over readlink
99
fi
10-
ROOT="$(dirname "$($READLINK -f "$(which "$0")")")"
10+
11+
if ! $READLINK -f "$(which "$0")" >& /dev/null; then
12+
ROOT="$(dirname "$(which "$0")")"
13+
if [ ! -f "$ROOT/hg-fast-export.py" ] ; then
14+
echo "hg-fast-exports requires a readlink implementation which knows" \
15+
" how to canonicalize paths in order to be called via a symlink."
16+
exit 1
17+
fi
18+
else
19+
ROOT="$(dirname "$($READLINK -f "$(which "$0")")")"
20+
fi
21+
1122
REPO=""
1223
PFX="hg2git"
1324
SFX_MAPPING="mapping"

0 commit comments

Comments
 (0)