Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing a remote's Git URL doesn't update the cache #185

Closed
ekohl opened this issue Oct 1, 2021 · 5 comments · Fixed by #197
Closed

Changing a remote's Git URL doesn't update the cache #185

ekohl opened this issue Oct 1, 2021 · 5 comments · Fixed by #197
Assignees

Comments

@ekohl
Copy link

ekohl commented Oct 1, 2021

Consider the following config

cachedir: '/var/cache/g10k'

sources:
  control:
    remote: 'https://example.com/my-git-repo'
    basedir: '/var/lib/g10k/environments'

Then I run g10k. This does what I want and we can see that:

# git -C /var/cache/g10k/environments/control.git remote -v
origin	https://example.com/my-git-repo (fetch)
origin	https://example.com/my-git-repo (push)

However, now my git repo URL changes:

cachedir: '/var/cache/g10k'

sources:
  control:
    remote: 'https://git.example.com/my-git-repo'
    basedir: '/var/lib/g10k/environments'

Again, I run g10k. This exits successfully. However, the code isn't updated. This is because the cache still points to the same remote.

# git -C /var/cache/g10k/environments/control.git remote -v
origin	https://example.com/my-git-repo (fetch)
origin	https://example.com/my-git-repo (push)

Removing control.git and running g10k again does result in a correct git remote.

@xorpaul
Copy link
Owner

xorpaul commented Oct 6, 2021

Hmm, can you think of a better solution than g10k always comparing the git remote at the beginning?

@ekohl
Copy link
Author

ekohl commented Oct 6, 2021

The other is to always set it. I haven't looked at the code, but I think git remote set-url is a pretty cheap operation. AFAIK it's only changing .git/config.

@xorpaul xorpaul self-assigned this May 24, 2022
@xorpaul xorpaul linked a pull request May 24, 2022 that will close this issue
xorpaul added a commit that referenced this issue May 25, 2022
* add detectGitRemoteUrlChange, fixes git remote url changes for control repo #185

* comment debug print format

* only purge control repo and fix typo

* only print this in debug

* satisfy GitHub Actions test
xorpaul added a commit that referenced this issue May 25, 2022
* rename whitelist to allowlist and blacklist to skiplist

* rename blacklist to skiplist

* rename whitelist to allowlist and blacklist to skiplist

* rename whitelist to allowlist and blacklist to skiplist

* rename whitelist to allowlist and blacklist to skiplist

* rename whitelist to allowlist and blacklist to skiplist

* rename whitelist to allowlist

* fix unintended .resource_types purge, because it was checked in the wrong section

* add local.yaml for testing

* add detectGitRemoteUrlChange (#197)

* add detectGitRemoteUrlChange, fixes git remote url changes for control repo #185

* comment debug print format

* only purge control repo and fix typo

* only print this in debug

* satisfy GitHub Actions test
@xorpaul
Copy link
Owner

xorpaul commented May 30, 2022

@xorpaul
Copy link
Owner

xorpaul commented May 30, 2022

098d9e3

@xorpaul
Copy link
Owner

xorpaul commented Nov 30, 2022

@xorpaul xorpaul closed this as completed Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants