g10k
g10k copied to clipboard
Changing a remote's Git URL doesn't update the cache
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.
Hmm, can you think of a better solution than g10k always comparing the git remote at the beginning?
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.
Fixed in https://github.com/xorpaul/g10k/releases/tag/v0.9.2
https://github.com/xorpaul/g10k/pull/196/commits/098d9e377748f691fd7b3b525b3a1abc500cf46f
Fixed in https://github.com/xorpaul/g10k/releases/tag/v0.9.2