<commit_before>#!/usr/bin/env bash

set -eu

SCRIPTS_DIR=$(readlink -f "$(dirname "$0")")

OUTPUT=$1
REPO=${2:-.}

python3 -m venv venv

. venv/bin/activate

pip install 'git_archive_all==1.19.4'

ABS_OUT=$(realpath "$OUTPUT")

TMPDIR=$(mktemp -d)
trap 'rm -rf $TMPDIR' EXIT
cp -r "$REPO" "$TMPDIR/aktualizr"

cd "$TMPDIR/aktualizr"
# include version in tarball
"$SCRIPTS_DIR/get_version.sh" > VERSION

git-archive-all "$ABS_OUT" --extra=VERSION<commit_msg>Avoid copying the repository when making tarballs<commit_after>#!/usr/bin/env bash

set -eux

SCRIPTS_DIR=$(readlink -f "$(dirname "$0")")

OUTPUT=$(realpath "$1")
REPO=$(realpath "${2:-.}")

python3 -m venv venv

. venv/bin/activate

# Use our fork which makes it easier to add extra files
# pip install 'git_archive_all==1.19.4'
pip install git+https://github.com/lbonn/git-archive-all.git

TMPDIR=$(mktemp -d)
trap 'rm -rf $TMPDIR' EXIT
cd "$TMPDIR"

# store version in archive
"$SCRIPTS_DIR/get_version.sh" git "$REPO" > VERSION

git-archive-all -C "$REPO" --extra VERSION "$OUTPUT"
{'fraction_non_alphanumeric': 0.1725790987535954, 'fraction_numerical': 0.015340364333652923, 'mean_word_length': 4.643243243243243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '2459874', 'n_tokens_mistral': 427, 'n_tokens_neox': 428, 'n_words': 104}