tests: Introduce count_config_entries_match() helper
remote: Introduce git_remote_delete()
remote: move branch upstream deletion to use an iterator

This should make it more readable and allocate a bunch fewer strings.
remote: remove remote-tracking branches on delete

When we delete a remote, we also need to go through its fetch refspecs
and remove the references they create locally.
Merge pull request #2313 from libgit2/cmn/remote-delete

Remote deletion
Win32: Supply _O_NOINHERIT when calling _wopen
Merge pull request #2360 from phkelley/noinherit

Win32: Supply _O_NOINHERIT when calling _wopen