#!/bin/sh

GITHUB_BASE='allisonkarlitskaya'
GITHUB_REPO='systemd_ctypes'
SUBDIR='modules/systemd_ctypes'

V="${V-0}" # default to friendly messages

set -eu
cd "${0%/*}/.."
. tools/git-utils.sh

# we default to check out the node_modules corresponding to the gitlink in the index
sha="${1-$(get_index_gitlink "${SUBDIR}")}"

# fetch by sha to prevent us from downloading something we don't want
fetch_sha_to_cache "${sha}"

# we're actually going to do this; let's remove the old one
rm -rf "modules/systemd_ctypes"
git submodule deinit "modules/systemd_ctypes"
rm -rf -- "$(git rev-parse --absolute-git-dir)/modules/systemd_ctypes"

# and check out the new one
# we need to use the tag name here, unfortunately
clone_from_cache "${sha}"
