gitbutler/crates/gitbutler-branch-actions/tests/fixtures/for-details.sh

56 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -eu -o pipefail
CLI=${1:?The first argument is the GitButler CLI}
function tick () {
if test -z "${tick+set}"; then
tick=1675176957
else
tick=$(($tick + 60))
fi
GIT_COMMITTER_DATE="$tick +0100"
GIT_AUTHOR_DATE="$tick +0100"
export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
}
tick
git init remote
(cd remote
echo first > file
git add . && git commit -m "init"
)
export GITBUTLER_CLI_DATA_DIR=../user/gitbutler/app-data
git clone remote complex-repo
(cd complex-repo
for round in $(seq 5); do
echo main >> file
git commit -am "main-$round"
done
local_tracking_ref="$(git rev-parse --symbolic-full-name @{u})";
git checkout -b feature main
for round in $(seq 100); do
echo feature >> file
git commit -am "feat-$round"
done
git checkout main
$CLI project add --switch-to-integration "$local_tracking_ref"
for round in $(seq 10); do
echo virtual-main >> file
$CLI branch commit --message "virt-$round" main
done
git checkout -b non-virtual-feature main
for round in $(seq 50); do
echo non-virtual-feature >> file
git commit -am "non-virtual-feat-$round"
done
# pretend the remote is at the same state as our local `main`
git update-ref refs/remotes/origin/main main
)