Add support for multiple sources in fetchGit #200
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When any of the git servers that are used to fetch sources is down, it causes an evaluation failure that prevents fetching the source. This could be solved by specifying multiple sources from where to fetch the git repository, but
builtin.fetchGitonly accepts one.We could make a wrapper around it and try several urls until one works, but the error that fetchGit throws cannot be captured by tryEval. It seems this restriction may be done to prevent errors being through when the evaluation order is not fixed.
However, for this particular case, we don't care about that. The following patch makes tryEval catch any error, including those thrown by
builtins.fetchGit.And this is the difference:
We may want to move this to its own builtin (maybe
builtins.catchAll?) so that we don't cause any difference in the evaluation of code that already uses tryEval. We can also usebuiltins ? catchAllto detect the presence of the builtin, and if not present fall back to the previous usage.On top of this builtin we can implement a robust fetchGit that accepts multiple sources.