#!/bin/bash
task_id=$1

echo "$tag $repo"

if [ -z "$2" ]; then
    tag=`git describe --abbrev=0 `
    repo=`git config --get remote.origin.url | sed 's!^.*:packages/!!'`
elif [ -z "$3" ]; then
    tag=$1
    repo=${tag%%/*}
else
    repo=$1
    tag=$2
fi

if [ -z "$task_id" ]; then
    ssh git.alt task add repo "$repo" "$tag"
else
    ssh git.alt task add "$task_id" repo "$repo" "$tag"
fi
