#!/bin/bash # SPDX-FileCopyrightText: 2023 Aravinth Manivannan # # SPDX-License-Identifier: AGPL-3.0-or-later set -euo pipefail readonly DIR=/tmp/git_cmd_init_tmp readonly REPO=$DIR/repo commit() { git add --all git commit \ --author="ftest-test-util-script " \ --message="$1" } write_commits_to_file() { pushd $REPO popd rm -rf $DIR/commits git log --pretty=oneline | cut -d ' ' -f 1 > $DIR/commits } init() { rm -rf $DIR || true mkdir -p $REPO cd $REPO git init echo "foo" > 1_commit.txt commit "first commit" echo "bar" > 2_commit.txt commit "second commit" write_commits_to_file } update() { cd $REPO echo "bar" >> 3_commit.txt commit "new commit" write_commits_to_file } $@ exit 0