Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge commit 'e63b85349a4765ed90db67e292c097dc65a3eed5'

* commit 'e63b85349a4765ed90db67e292c097dc65a3eed5':
  is this script properly canonical?
  • Loading branch information...
commit c3c285dcb4bdf2222452199d77625134faa73a06 2 parents 899be67 + e63b853
@cosmin cosmin authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 bin/git-hg
View
13 bin/git-hg
@@ -7,7 +7,16 @@ fi
set -e
-# Functionality also available with GNU coreutils readlink --canonicalize
+# Try to use GNU Coreutils readlink --canonicalize if available,
+# falling back to less robust shell script only if not found.
+if which greadlink >&/dev/null; then
+ canon="greadlink --canonicalize"
+elif readlink --canonicalize / >&/dev/null; then
+ canon="readlink --canonicalize"
+else
+ canon=canonicalize
+fi
+
function canonicalize {
path="$1"
@@ -27,7 +36,7 @@ function canonicalize {
printf "%s/%s\n" "$cdir" "$file"
}
-GITHG_HOME=$(canonicalize $(dirname $(canonicalize $0))/..)
+GITHG_HOME=$($canon $(dirname $($canon $0))/..)
HG_FAST_EXPORT=$GITHG_HOME/fast-export/hg-fast-export.sh
function git-current-branch {
Please sign in to comment.
Something went wrong with that request. Please try again.