#!/bin/bash
. /usr/bin/mithraen-build-utils-functions

task_id=$1

echo "$tag $repo"

if [ -z "$2" ]; then
    tag=`git describe --abbrev=0 `
    repo=`gitalt_get_repo`
elif [ -z "$3" ]; then
    tag=$1
    repo=${tag%%/*}
else
    repo=$1
    tag=$2
fi

echo "tag: $tag"
echo "repo: $repo"

if [ -z "$task_id" ]; then
    git.alt task add repo "$repo" "$tag" \
		2>&1 \
		| csed '/not\ found/ p red,bold'
else
    git.alt task add "$task_id" repo "$repo" "$tag" \
		2>&1 \
		| csed '/not\ found/ p red,bold'
fi

exit $?

