Skip to content

Instantly share code, notes, and snippets.

@EricCrosson
Last active March 2, 2022 12:34
Show Gist options
  • Save EricCrosson/ed9999fee5cec3c3ef19df8c325343ac to your computer and use it in GitHub Desktop.
Save EricCrosson/ed9999fee5cec3c3ef19df8c325343ac to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
readonly chezmoi_dir="${HOME}/.local/share/chezmoi"
readonly git_submodule_sha_dir="${chezmoi_dir}/.git-submodule-shas"
cd "${chezmoi_dir}" || exit
mkdir -p "${git_submodule_sha_dir}"
IFS=$'\n'
for submodule in $(git submodule status)
do
# drop the dirty bit
description="${submodule:1}"
repo="$(echo "$description" | awk '{print $2}')"
hash="$(echo "$description" | awk '{print $1}')"
echo "$hash" > "${git_submodule_sha_dir}/${repo}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment