Last active
March 2, 2022 12:34
-
-
Save EricCrosson/ed9999fee5cec3c3ef19df8c325343ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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