#!/bin/bash
#
# Copyright (C) 2013 Anders Logg and Martin Sandve Alnaes
#
# This file is part of FFC.
#
# FFC is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FFC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFC. If not, see <http://www.gnu.org/licenses/>.
#
# First added:  2013-04-22
# Last changed: 2013-08-21
#
# This script checks out reference data by the given commit id,
# or if none given using the commit id found in data id file.

# Parameters
source scripts/parameters

# Take data id as optional argument or get from file
DATA_ID=$1 && [ -z "$DATA_ID" ] && DATA_ID=`cat $DATA_ID_FILE`

# Checkout data referenced by id
(cd $DATA_DIR && git checkout -B auto $DATA_ID)
exit $?
