Fix the first Windows integration test error, paths

We have to be able to convert from MinGW paths to native Windows paths,
and also to handle those paths in Bash without the '\' characters
escaping into tabs etc. This commit fixes the very first test in
test-env.sh as a proof of concept
This commit is contained in:
Steve Streeting 2015-10-16 13:28:34 +01:00
parent 4cad027db7
commit 4c1e5ac12d
3 changed files with 34 additions and 8 deletions

@ -13,17 +13,25 @@ begin_test "env with no remote"
cd $reponame
git init
expected=$(printf "%s\n%s\n
LocalWorkingDir=$TRASHDIR/$reponame
LocalGitDir=$TRASHDIR/$reponame/.git
LocalGitStorageDir=$TRASHDIR/$reponame/.git
LocalMediaDir=$TRASHDIR/$reponame/.git/lfs/objects
TempDir=$TRASHDIR/$reponame/.git/lfs/tmp
localwd=$(native_path "$TRASHDIR/$reponame")
localgit=$(native_path "$TRASHDIR/$reponame/.git")
localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
expected=$(printf '%s
%s
LocalWorkingDir=%s
LocalGitDir=%s
LocalGitStorageDir=%s
LocalMediaDir=%s
TempDir=%s
ConcurrentTransfers=3
BatchTransfer=true
$(env | grep "^GIT")
%s
" "$(git lfs version)" "$(git version)" "$envInitConfig")
%s
' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$(env | grep "^GIT")" "$envInitConfig")
actual=$(git lfs env)
[ "$expected" = "$actual" ]
)

@ -49,6 +49,13 @@ TESTHOME="$REMOTEDIR/home"
GIT_CONFIG_NOSYSTEM=1
UNAME=$(uname -s)
IS_MINGW_CYGWIN=0
if [[ $UNAME == MINGW* || $UNAME == CYGWIN* ]]
then
IS_MINGW_CYGWIN=1
fi
export CREDSDIR
if [[ `git config --system credential.helper | grep osxkeychain` == "osxkeychain" ]]

@ -382,3 +382,14 @@ get_date() {
date $ARGS -u +%Y-%m-%dT%TZ
fi
}
# Convert potentially MinGW bash paths to native Windows paths
# Needed to match generic built paths in test scripts to native paths generated from Go
native_path() {
if [ $IS_MINGW_CYGWIN ]; then
# Use params form to avoid interpreting any '\' characters
printf '%s' "$(cygpath -w $1)"
else
printf '%s' "$1"
fi
}