Add tests for "git describe --long".

* Move test logic to scm-update.sh scripts.
    * Check for "git describe --long".
This commit is contained in:
Nicolas Pierron
2012-04-29 20:59:43 -07:00
parent 1033178728
commit 69f9175986
11 changed files with 242 additions and 64 deletions

View File

@ -1 +1,19 @@
#! /bin/sh
repo="$1"
STATE_FILE=$(pwd)/.bzr-checkout-state
if test -e $STATE_FILE; then
state=$(cat $STATE_FILE)
test $state -gt 1 && state=0
else
state=0;
fi
case $state in
(0) echo "::Create repo. -- continue -- updated::"
ln -s bzr-repo bzr-checkout-repo
;;
(*) echo "::End. -- stop -- nothing::" ;;
esac
echo $(($state + 1)) > $STATE_FILE

View File

@ -1 +1,24 @@
#! /bin/sh
repo="$1"
STATE_FILE=$(pwd)/.bzr-state
if test -e $STATE_FILE; then
state=$(cat $STATE_FILE)
test $state -gt 1 && state=0
else
state=0;
fi
export BZR_HOME; # Set by the Makefile
case $state in
(0) echo "::Create repo. -- continue -- updated::"
bzr init bzr-repo
bzr whoami "build <build@donotemail.com>" -d bzr-repo
touch bzr-repo/bzr-file
bzr add bzr-repo/bzr-file
bzr commit -m "add bzr-file" bzr-repo/bzr-file
;;
(*) echo "::End. -- stop -- nothing::";;
esac
echo $(($state + 1)) > $STATE_FILE

View File

@ -0,0 +1,6 @@
#! /bin/sh
set -e
mkdir $out
cp -v $src/* $out/
git describe --long > $out/Version

View File

@ -0,0 +1,10 @@
with import ./config.nix;
{ src }:
{
copy =
mkDerivation {
name = "git-input";
builder = ./scm-builder.sh;
inherit src;
};
}

View File

@ -1,25 +1,49 @@
#! /bin/sh
# This script is used both by git & deepgit checks.
cd "$1"
STATE_FILE=.state
repo=git-repo
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
case $state in
(0)
echo "Add new file."
touch git-file-2
git add git-file-2 >&2
git commit -m "add git file 2" git-file-2 >&2
(0) echo "::Create repo. -- continue -- updated::"
git init $repo
cd $repo
touch foo
git add foo
git commit -m "Add foo"
git tag -a -m "First Tag." tag0
git checkout -b master HEAD
;;
(1)
echo "Rewrite commit."
echo 1 > git-file-2
git add git-file-2 >&2
git commit --amend -m "add git file 2" git-file-2 >&2
(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

View File

@ -1 +1,23 @@
#! /bin/sh
repo="$1"
STATE_FILE=$(pwd)/.hg-state
if test -e $STATE_FILE; then
state=$(cat $STATE_FILE)
test $state -gt 1 && state=0
else
state=0;
fi
case $state in
(0) echo "::Create repo. -- continue -- updated::"
hg init hg-repo
touch hg-repo/hg-file
cd hg-repo
hg add hg-file
hg commit -m "add hg file" hg-file -u foobar
;;
(*) echo "::End. -- stop -- nothing::" ;;
esac
echo $(($state + 1)) > $STATE_FILE

View File

@ -1 +1,19 @@
#! /bin/sh
repo="$1"
STATE_FILE=$(pwd)/.svn-checkout-state
if test -e $STATE_FILE; then
state=$(cat $STATE_FILE)
test $state -gt 1 && state=0
else
state=0;
fi
case $state in
(0) echo "::Create repo. -- continue -- updated::"
ln -s svn-repo svn-checkout-repo
;;
(*) echo "::End. -- stop -- nothing::" ;;
esac
echo $(($state + 1)) > $STATE_FILE

View File

@ -1 +1,23 @@
#! /bin/sh
repo="$1"
STATE_FILE=$(pwd)/.svn-state
if test -e $STATE_FILE; then
state=$(cat $STATE_FILE)
test $state -gt 1 && state=0
else
state=0;
fi
case $state in
(0) echo "::Create repo. -- continue -- updated::"
svnadmin create svn-repo
svn co $repo svn-checkout
touch svn-checkout/svn-file
svn add svn-checkout/svn-file
svn commit -m "add svn file" svn-checkout/svn-file
;;
(*) echo "::End. -- stop -- nothing::";;
esac
echo $(($state + 1)) > $STATE_FILE