# @TEST-EXEC: zkg install foo
# @TEST-EXEC: btest-diff scripts/packages/foo/__load__.zeek

# @TEST-EXEC: zkg install alice/bar
# @TEST-EXEC: btest-diff scripts/packages/bar/__load__.zeek

# @TEST-EXEC: zkg install one/alice/baz
# @TEST-EXEC: btest-diff scripts/packages/baz/__load__.zeek

# @TEST-EXEC: zkg install $(pwd)/packages/qux
# @TEST-EXEC: btest-diff scripts/packages/qux/__load__.zeek

# @TEST-EXEC: bash %INPUT

# @TEST-EXEC: zkg install corge
# @TEST-EXEC: btest-diff scripts/packages/corge/__load__.zeek

# @TEST-EXEC: zkg remove corge
# @TEST-EXEC: ( cd $(pwd)/packages/corge && git rev-parse --abbrev-ref HEAD ) > default_branch_name
# @TEST-EXEC: zkg install corge --version=$(cat default_branch_name)
# @TEST-EXEC: cp scripts/packages/corge/__load__.zeek corge.master
# @TEST-EXEC: btest-diff corge.master

cd packages/corge
git tag -a 1.0.0 -m 1.0.0
echo 'print "hello";' >> __load__.zeek
git commit -am 'new stuff'

cd ../grault
echo 'print "grault 1.0.0";' > __load__.zeek
git commit -am 'new stuff'
git tag -a 1.0.0 -m 1.0.0
echo 'print "grault 1.0.1";' > __load__.zeek
git commit -am 'new stuff'
git tag -a v1.0.1 -m 1.0.1
echo 'print "grault 1.0.2";' > __load__.zeek
git commit -am 'new stuff'
git tag -a 1.0.2 -m 1.0.2

# @TEST-EXEC: zkg install grault
# @TEST-EXEC: btest-diff scripts/packages/grault/__load__.zeek

# @TEST-EXEC: zkg remove grault
# @TEST-EXEC: zkg install grault --version=v1.0.1
# @TEST-EXEC: cp scripts/packages/grault/__load__.zeek grault.1.0.1
# @TEST-EXEC: btest-diff grault.1.0.1
#
# @TEST-EXEC: zkg remove grault
# @TEST-EXEC: (cd packages/grault && git checkout --detach)
# @TEST-EXEC: zkg install $(pwd)/packages/grault
# @TEST-EXEC: cp scripts/packages/grault/__load__.zeek grault.detached
# @TEST-EXEC: btest-diff grault.detached
# @TEST-EXEC: zkg info grault | grep tracking_method > grault.info
# @TEST-EXEC: btest-diff grault.info
#
# @TEST-EXEC: zkg remove grault
# @TEST-EXEC: (cd packages/grault && git checkout 1.0.0)
# @TEST-EXEC: (cd packages/grault && git rev-parse HEAD) > grault.head.hash
# @TEST-EXEC: zkg install grault --version=$(cat grault.head.hash)
# @TEST-EXEC: cp scripts/packages/grault/__load__.zeek grault.detached.head
# @TEST-EXEC: btest-diff grault.detached.head
# @TEST-EXEC: zkg info grault | grep tracking_method > grault.info
# @TEST-EXEC: btest-diff grault.info
