[S] Change in osmo-ttcn3-hacks[master]: deps: move "update url" logic into update.sh
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43168?usp=email ) Change subject: deps: move "update url" logic into update.sh ...................................................................... deps: move "update url" logic into update.sh Prepare to add a function that gets the proper git clone URL for gitlab repos in the next patch. In order to do this, we need to have the update url logic in update.sh first. Change-Id: I18a56cae6b0c35b205f15ef117d9d4354aef6c79 --- M deps/Makefile M deps/update.sh 2 files changed, 14 insertions(+), 5 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/deps/Makefile b/deps/Makefile index 4a6bd90..7df5746 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -140,10 +140,6 @@ ifeq ($$($(1)_MODIFIED),1) @echo "WARNING: $(1) skipped because it contains uncommitted modifications!" else -ifneq ($$($(1)_ORIGIN),$(2)/$(1)) - @echo "[$(1)] Updating URL to $(2)/$(1)" - @cd $(1) && git remote set-url origin $(2)/$(1) && git fetch -endif ifneq ($$($(1)_HEAD),$($(1)_commit)) @./update.sh "$(1)" "$($(1)_commit)" "$(2)" endif diff --git a/deps/update.sh b/deps/update.sh index 4a52279..332ce23 100755 --- a/deps/update.sh +++ b/deps/update.sh @@ -3,7 +3,20 @@ COMMIT="$2" URL_PREFIX="$3" -if ! [ -d "$DIR" ]; then +update_url() { + local current="$(git -C "$DIR" remote get-url origin)" + local full_url="$URL_PREFIX"/"$DIR" + + if [ "$current" != "$full_url" ]; then + echo "[$DIR] Updating URL to $full_url" + git -C "$DIR" remote set-url origin "$full_url" + git -C "$DIR" fetch + fi +} + +if [ -d "$DIR" ]; then + update_url +else echo "[$DIR] Initial git clone" git clone -q "$URL_PREFIX"/"$DIR" fi -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43168?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I18a56cae6b0c35b205f15ef117d9d4354aef6c79 Gerrit-Change-Number: 43168 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de>
participants (1)
-
osmith