Last active
June 26, 2024 06:49
-
-
Save tomi-font/e548c23c7d9a321d452dde9c4cc43fa4 to your computer and use it in GitHub Desktop.
Git hook to automatically run `west update` if the manifest file changed after a checkout/merge/rebase.
This file contains 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 | |
# | |
# Based on: https://gist.github.com/foca/3148204 | |
# | |
# Install into: | |
# - .git/hooks/post-checkout | |
# - .git/hooks/post-merge | |
# - .git/hooks/post-rewrite | |
# - .git/hooks/post-commit | |
# | |
# And make sure all are executable. | |
# | |
# Then change the $MANIFEST_FILE_PATH appropriately. | |
# The path starts from the root of the repository. | |
# | |
# Note that this covers the most common git operations | |
# but not all of them, so remain aware of the possibiltiy | |
# that your West workspace is left unupdated. | |
MANIFEST_FILE_PATH="west.yml" | |
if ! git diff --exit-code --quiet HEAD@{1}..HEAD@{0} "$MANIFEST_FILE_PATH"; then | |
west update | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment