2012-04-15 01:17:35 +00:00
|
|
|
#! /bin/sh
|
2012-04-30 03:59:43 +00:00
|
|
|
# This script is used both by git & deepgit checks.
|
2012-06-25 11:33:36 +00:00
|
|
|
set -e
|
2012-04-15 01:17:35 +00:00
|
|
|
|
2012-04-30 03:59:43 +00:00
|
|
|
repo=git-repo
|
2012-06-25 11:33:36 +00:00
|
|
|
export HOME=$(pwd)
|
2012-04-30 03:59:43 +00:00
|
|
|
STATE_FILE=$(pwd)/.git-state
|
2012-04-15 01:17:35 +00:00
|
|
|
if test -e $STATE_FILE; then
|
|
|
|
state=$(cat $STATE_FILE)
|
2012-04-30 03:59:43 +00:00
|
|
|
test $state -gt 3 && state=0
|
2012-04-15 01:17:35 +00:00
|
|
|
else
|
|
|
|
state=0;
|
|
|
|
fi
|
|
|
|
|
2012-06-25 11:33:36 +00:00
|
|
|
echo "STATE: $state"
|
2012-04-15 01:17:35 +00:00
|
|
|
case $state in
|
2012-06-25 11:33:36 +00:00
|
|
|
(0) echo "::Create repo. -- continue -- updated::"
|
2012-04-30 03:59:43 +00:00
|
|
|
git init $repo
|
|
|
|
cd $repo
|
2012-06-25 11:33:36 +00:00
|
|
|
git config --global user.email "you@example.com"
|
|
|
|
git config --global user.name "Your Name"
|
|
|
|
|
2012-04-30 03:59:43 +00:00
|
|
|
touch foo
|
|
|
|
git add foo
|
|
|
|
git commit -m "Add foo"
|
|
|
|
git tag -a -m "First Tag." tag0
|
2012-04-15 01:17:35 +00:00
|
|
|
;;
|
2012-04-30 03:59:43 +00:00
|
|
|
(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
|
2012-04-15 01:17:35 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo $(($state + 1)) > $STATE_FILE
|