Scripts for syncing the state of the vendor forlder with the workspace
This commit is contained in:
parent
325e03f419
commit
2519e69fc8
|
@ -0,0 +1,14 @@
|
||||||
|
function copy_revision {
|
||||||
|
if [ -d "$1" ] && [ -d "$2" ]; then
|
||||||
|
pushd "$1" > /dev/null
|
||||||
|
COMMIT="$(git rev-parse HEAD)"
|
||||||
|
echo Switching "$(basename "$2")" to $COMMIT
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
pushd "$2"
|
||||||
|
git checkout "$COMMIT"
|
||||||
|
popd > /dev/null
|
||||||
|
else
|
||||||
|
echo "Usage: copy_revision <git-dir-1> <git-dir-2>"
|
||||||
|
fi
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
shopt -s nocaseglob
|
||||||
|
|
||||||
|
GIR_PROJECT_DIR=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
|
cd "$GIT_PROJECT_DIR"
|
||||||
|
|
||||||
|
if [ ! -d vendor ]; then
|
||||||
|
SCRIPT_NAME=$(basename "$0")
|
||||||
|
echo "${SCRIPT_NAME} must be executed within a git repo, holding a 'vendor' folder"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source ../scripts/lib/git-helpers
|
||||||
|
|
||||||
|
for submodule in vendor/*/; do
|
||||||
|
WORKSPACE_DIR="../$(basename "$submodule")"
|
||||||
|
if [ -d "$WORKSPACE_DIR" ]; then
|
||||||
|
copy_revision "$WORKSPACE_DIR" "$submodule"
|
||||||
|
fi
|
||||||
|
done
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
shopt -s nocaseglob
|
||||||
|
|
||||||
|
GIR_PROJECT_DIR=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
|
cd "$GIT_PROJECT_DIR"
|
||||||
|
|
||||||
|
if [ ! -d vendor ]; then
|
||||||
|
SCRIPT_NAME=$(basename "$0")
|
||||||
|
echo "${SCRIPT_NAME} must be executed within a git repo, holding a 'vendor' folder"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source ../scripts/lib/git-helpers
|
||||||
|
|
||||||
|
for submodule in vendor/*/; do
|
||||||
|
WORKSPACE_DIR="../$(basename "$submodule")"
|
||||||
|
if [ -d "$WORKSPACE_DIR" ]; then
|
||||||
|
copy_revision "$submodule" "$WORKSPACE_DIR"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in New Issue