<commit_before>#!/bin/bash

if [ "$REPO" = "localfs" ]; then
  SSHCMD=""
fi

function getBundleFolder() {
  [ "$BUNDLE_FOLDER" ] && return # avoid re-reading branches.csv
  local BUNDLE=$1

  BUNDLE_FOLDER=$($SSHCMD find ${REPOBASE} -maxdepth 2 -type d -name ${BUNDLE})

  if [ -z "${BUNDLE_FOLDER}" ]; then
    echo "Bundle not found: $BUNDLE"
    exit 1
  elif [ $(echo "${BUNDLE_FOLDER}" | wc -l) -ne 1 ]; then
    echo "Expected 1 Bundle, but got: $BUNDLE_FOLDER"
    exit 1
  fi
}

function dirMustExist() {
  local DIR=$1
  if $SSHCMD [ ! -d "$DIR" ]; then
    echo "Directory does not exist: $DIR"
    exit 1
  fi
}

function dirMustNotExist() {
  local DIR=$1
  if $SSHCMD [ -d "$DIR" ]; then
    echo "Directory already exists: $DIR"
    exit 1
  fi
}

function createLocalDirIfNotExists() {
  local DIR=$1<commit_msg>Revert "Merge pull request #14 from marvinthepa/bugfix/die-if-multiple-bundle-folders-found"<commit_after>#!/bin/bash

if [ "$REPO" = "localfs" ]; then
  SSHCMD=""
fi

function getBundleFolder() {
  [ "$BUNDLE_FOLDER" ] && return # avoid re-reading branches.csv
  local BUNDLE=$1

  BUNDLE_FOLDER=$($SSHCMD find ${REPOBASE} -maxdepth 2 -type d -name ${BUNDLE})

  if [ -z "${BUNDLE_FOLDER}" ]; then
    echo "Bundle not found: $BUNDLE"
    exit 1
  fi
}

function dirMustExist() {
  local DIR=$1
  if $SSHCMD [ ! -d "$DIR" ]; then
    echo "Directory does not exist: $DIR"
    exit 1
  fi
}

function dirMustNotExist() {
  local DIR=$1
  if $SSHCMD [ -d "$DIR" ]; then
    echo "Directory already exists: $DIR"
    exit 1
  fi
}

function createLocalDirIfNotExists() {
  local DIR=$1
{'fraction_non_alphanumeric': 0.14720496894409937, 'fraction_numerical': 0.013043478260869565, 'mean_word_length': 3.3306451612903225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3285536', 'n_tokens_mistral': 649, 'n_tokens_neox': 639, 'n_words': 174}