diff options
Diffstat (limited to 'xmake/plugins')
| -rw-r--r-- | xmake/plugins/repo/main.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xmake/plugins/repo/main.lua b/xmake/plugins/repo/main.lua index f11e350c5..efc0c4207 100644 --- a/xmake/plugins/repo/main.lua +++ b/xmake/plugins/repo/main.lua @@ -127,6 +127,13 @@ function _update() if os.isdir(repodir) then -- only update the local repository with the remote url if not os.isdir(repo:url()) then + -- check and update remote URL if it differs from repo:url() + local current_url = git.remote.get_url({repodir = repodir}) + local expected_url = repo:url() + if current_url ~= expected_url then + vprint("updating remote URL for repository(%s): %s -> %s", repo:name(), current_url or "<none>", expected_url) + git.remote.set_url(expected_url, {repodir = repodir}) + end vprint("pulling repository(%s): %s to %s ..", repo:name(), repo:url(), repodir) git.reset({verbose = option.get("verbose"), repodir = repodir, hard = true}) git.pull({verbose = option.get("verbose"), branch = repo:branch(), repodir = repodir, force = true}) |
