#!/bin/bash
# from the bottom up, fetch the desired remote (and potentially branch)

# Verify that we are in the super-repo
[ -d CanAM ] ||  { echo "ERROR: You MUST be in the CanESM super-repo" ; exit 1 ; }

# build command for fetching at the lower repos
#  - necessary to avoid issues that occur when one tries to fetch a specific branch 
#    and passing 2 arguments to git-sfed
cmd="git fetch $@"

# First recurse every submodule from the bottom up.
git sfed "$cmd"

# Repeat in super-repo
git fetch $@

