Closed GrantBirki closed 2 months ago
Other methods in the Git resolver do exactly this so we should lean into it here as well.
We're only reading config
file directly in valid_repository?
. I don't know the reason for this, but it appears we could just use git config
instead. Going through the CLI is easier and safer. The git configuration format is quite powerful and supports some forms of indirection that we would need to take into account. I'd prefer to avoid parsing config
file directly if possible. Going through the CLI should always be better.
You mentioned in https://github.com/crystal-lang/shards/issues/628#issuecomment-2325707808 that you couldn't get the expected behaviour to work. But it's not quite clear to me what didn't work and why. It seems that it should be possible to do this without reading the config
file directly.
In order to understand whether this is working as expected, we should add a spec to test the behaviour.
This pull request changes how the
origin_url
method works for the Git resolver. Rather than trying to run native git commands, this method now peers into thelocal_path
dir for the cached shard and directly reads from the INIconfig
file which contains the origin URL. Other methods in the Git resolver do exactly this so we should lean into it here as well.resolves: https://github.com/crystal-lang/shards/issues/628