diff options
| author | Máté Ferenc Nagy-Egri <mate@rastergrid.com> | 2024-10-28 15:33:49 +0100 |
|---|---|---|
| committer | Charles Giessen <46324611+charles-lunarg@users.noreply.github.com> | 2024-10-28 09:57:25 -0600 |
| commit | 7a963034352e8c0dfddd97380e5f328bc471c996 (patch) | |
| tree | 3ff17ae948e29860f03940b2aac5d352ebf58642 /scripts | |
| parent | 9e1ba445cb9ef5267c6062e91c2fa978b1771ba6 (diff) | |
| download | usermoji-7a963034352e8c0dfddd97380e5f328bc471c996.tar.xz | |
scripts: Handle remote URL change in update_deps.py
Without going through an intricate dance with git to change the remote
URL of a repository, it's simplest to just nuke the cloned folder, as
we have to do a clean clone anyway.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/update_deps.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/update_deps.py b/scripts/update_deps.py index d010f9b2..24d125a9 100755 --- a/scripts/update_deps.py +++ b/scripts/update_deps.py @@ -415,8 +415,15 @@ class GoodRepo(object): if VERBOSE: print('Checking out {n} in {d}'.format(n=self.name, d=self.repo_dir)) - if self._args.do_clean_repo: + if os.path.exists(os.path.join(self.repo_dir, '.git')): + url_changed = command_output(['git', 'config', '--get', 'remote.origin.url'], self.repo_dir).strip() != self.url + else: + url_changed = False + + if self._args.do_clean_repo or url_changed: if os.path.isdir(self.repo_dir): + if VERBOSE: + print('Clearing directory {d}'.format(d=self.repo_dir)) shutil.rmtree(self.repo_dir, onerror = on_rm_error) if not os.path.exists(os.path.join(self.repo_dir, '.git')): self.Clone() |
