]> git.ipfire.org Git - thirdparty/git.git/commit
fetch: replace string-list used as a look-up table with a hashmap
authorJunio C Hamano <gitster@pobox.com>
Tue, 25 Sep 2018 20:25:04 +0000 (13:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Nov 2018 05:37:13 +0000 (14:37 +0900)
commite198b3a740409fabe5ba774c5f1255b55fdd21c1
tree726260532ec8aad4f72c2b033d721e00865d5523
parentfe8321ec057f9231c26c29b364721568e58040f7
fetch: replace string-list used as a look-up table with a hashmap

In find_non_local_tags() helper function (used to implement the
"follow tags"), we use string_list_has_string() on two string lists
as a way to see if a refname has already been processed, etc.

All this code predates more modern in-core lookup API like hashmap;
replace them with two hashmaps and one string list---the hashmaps
are used for look-ups and the string list is to keep the order of
items in the returned result stable (which is the only single thing
hashmap does worse than lookups on string-list).

Similarly, get_ref_map() uses another string-list as a look-up table
for existing refs.  Replace it with a hashmap.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c