-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check for remotes being as expected
Since we moved GenConfig and some of its associated repositories, get_dependencies.sh should detect and tell the user that they will need to allow it to re-clone them if their remotes are out-of-date. Otherwise pulls can/will fail. Signed-off-by: Samuel E. Browne <[email protected]>
- Loading branch information
Showing
1 changed file
with
16 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,11 +36,23 @@ function tril_genconfig_clone_or_update_repo() { | |
echo | ||
|
||
if [[ -d ${sub_dir} ]] ; then | ||
echo "STATUS: ${sub_dir}: Fetching remote repo" | ||
cd ${sub_dir} | ||
tril_genconfig_assert_pwd_is_git_repo | ||
cmd="git fetch" | ||
retry_command "${cmd}" | ||
remote=$(git remote get-url origin) | ||
if [[ ${git_url} == *"${remote}"* ]] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sebrowne
Author
Contributor
|
||
then | ||
echo "STATUS: ${sub_dir}: Fetching remote repo" | ||
tril_genconfig_assert_pwd_is_git_repo | ||
cmd="git fetch" | ||
retry_command "${cmd}" | ||
else | ||
echo "ERROR: Current remote origin does not match expected!" >&2 | ||
echo "Please remove/move '$(pwd)' and re-run this script" >&2 | ||
echo "" >&2 | ||
echo "Current: ${remote}" >&2 | ||
echo "Expected: ${git_url}" >&2 | ||
echo "" >&2 | ||
exit 1 | ||
fi | ||
else | ||
echo "STATUS: ${sub_dir}: Cloning from '${git_url}'" | ||
cmd="git clone ${git_url} ${sub_dir}" | ||
|
@sebrowne, the one thing that would trip me up and other developers is that I use
git@<site-base>:<org>/<repo>.git
instead ofhttps:<site-base>/<org>/<repo>.git
. The way to fix this would be extract and normalize the part<site-base>:<org>/<repo>
and match on that. May not be all that hard to do that normalization.