diff --git a/test_e2e.sh b/test_e2e.sh index 7ce84c4..915318c 100755 --- a/test_e2e.sh +++ b/test_e2e.sh @@ -78,6 +78,22 @@ if [[ -z "$DIR" ]]; then fi echo "test root is $DIR" +REPO="$DIR/repo" +function init_repo() { + rm -rf "$REPO" + mkdir -p "$REPO" + git -C "$REPO" init -q + touch "$REPO"/file + git -C "$REPO" add file + git -C "$REPO" commit -aqm "init file" +} + +ROOT="$DIR/root" +function clean_root() { + rm -rf "$ROOT" + mkdir -p "$ROOT" +} + function finish() { if [ $? -ne 0 ]; then echo "The directory $DIR was not removed as it contains"\ @@ -85,9 +101,11 @@ function finish() { remove_sync_container fi } - trap finish INT EXIT +SLOW_GIT=/slow_git.sh +ASKPASS_GIT=/askpass_git.sh + CONTAINER_NAME=git-sync-$RANDOM$RANDOM function GIT_SYNC() { #./bin/linux_amd64/git-sync "$@" @@ -111,25 +129,6 @@ function remove_sync_container() { docker rm -f $CONTAINER_NAME >/dev/null 2>&1 } -SLOW_GIT=/slow_git.sh -ASKPASS_GIT=/askpass_git.sh - -REPO="$DIR/repo" -function init_repo() { - rm -rf "$REPO" - mkdir -p "$REPO" - git -C "$REPO" init -q - touch "$REPO"/file - git -C "$REPO" add file - git -C "$REPO" commit -aqm "init file" -} - -ROOT="$DIR/root" -function clean_root() { - rm -rf "$ROOT" - mkdir -p "$ROOT" -} - ############################################## # Test HEAD one-time ##############################################