Closed agausmann closed 1 year ago
Thanks, please add a unit test.
For reference I think iteration should yield the names, like references/branches do, but that breaks compatibility.
Also I'm unsure which is best names()
or keys()
, names is more like git, keys is more like python.
Motivation
This
names()
iterator provides a big benefit in performance in my use case, where I want to test whether or not a remote exists for a large number of potential remote names (hundreds)The first code I used looked something like:
However, this performs a lookup for all remote names, which was prohibitively expensive. So I decided to try collecting all the names into a set beforehand:
However, this still performs a lookup for each remote to create the
Remote
objects yielded by the iterator.With
RemoteCollection.names()
, I can construct the set much more efficiently: