Files
.github
datadog
doc
examples
foreman
src
t
Hydra
evaluator
input-types
jobs
declarative
dependencies
aggregate.nix
api-test.nix
basic.nix
broken-constituent.nix
build-output-as-input.nix
build-product-simple.sh
build-product-with-spaces.sh
build-products.nix
bzr-checkout-input.nix
bzr-checkout-update.sh
bzr-input.nix
bzr-update.sh
config.nix.in
constituents.nix
darcs-input.nix
darcs-update.sh
deepgit-builder.sh
deepgit-input.nix
default-machine-file.nix
empty-dir-builder.sh
fail.sh
git-input.nix
git-rev-input.nix
git-rev-update.sh
git-update.sh
hg-input.nix
hg-update.sh
hydra-eval-notifications.nix
nested-attributes.nix
notifications.nix
one-job.nix
runcommand.nix
scm-builder.sh
server.py
succeed-with-failed.sh
svn-checkout-input.nix
svn-checkout-update.sh
svn-input.nix
svn-update.sh
lib
queue-runner
scripts
Makefile.am
api-test.t
build-products.t
perlcritic.pl
s3-backup-test.config
s3-backup-test.pl
setup-notifications-jobset.pl
test.pl
.editorconfig
.gitignore
.perlcriticrc
.yath.rc
COPYING
INSTALL
Makefile.am
Procfile
README.md
bootstrap
configure.ac
default.nix
flake.lock
flake.nix
hydra-api.yaml
hydra-module.nix
shell.nix
version.txt
hydra/t/jobs/git-update.sh
Cole Helbling 025be052b7 tests: move to t, allow yath test from root
By moving the tests subdirectory to t, we gain the ability to run `yath
test` with no arguments from inside `nix develop` in the root of the
the repo.

(`nix develop` is necessary in order to set the proper env vars for
`yath` to find our test libraries.)
2021-03-05 09:49:06 -08:00

57 lines
1.3 KiB
Bash
Executable File

#! /bin/sh
# This script is used both by git & deepgit checks.
set -e
repo=git-repo
export HOME=$(pwd)
export XDG_CONFIG_HOME=$(pwd)/.config
STATE_FILE=$(pwd)/.git-state
if test -e $STATE_FILE; then
state=$(cat $STATE_FILE)
test $state -gt 3 && state=0
else
state=0;
fi
echo "STATE: $state"
case $state in
(0) echo "::Create repo. -- continue -- updated::"
git init $repo
cd $repo
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
touch foo
git add foo
git commit -m "Add foo"
git tag -a -m "First Tag." tag0
;;
(1) echo "::Create new commit. -- continue -- updated::"
cd $repo
# Increase depth to make sure the tag is not fetched by default.
echo 0 > foo
git add foo
git commit -m "Increase depth 0"
echo 1 > foo
git add foo
git commit -m "Increase depth 1"
echo 2 > foo
git add foo
git commit -m "Increase depth 2"
echo 0 > bar
git add bar
git commit -m "Add bar with 0"
;;
(2) echo "::Amend commit. (push -f) -- continue -- updated::"
cd $repo
echo 1 > bar
git add bar
git commit --amend -m "Add bar with 1"
;;
(*) echo "::End. -- stop -- nothing::"
rm -rf $repo
;;
esac
echo $(($state + 1)) > $STATE_FILE