diff options
| author | ruki <[email protected]> | 2025-12-03 00:34:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-12-03 00:34:43 +0800 |
| commit | f41c8d038f8896019b0c8cb64da0dd523c8a1c82 (patch) | |
| tree | 888ed00c22185c0db3d5b768b5e3ea9e7d9a0c2e /xmake/plugins | |
| parent | edb55f6a7799181a2dfbd4eb8b6cf1f8be2f4f32 (diff) | |
update repo url
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}) |
