I really need some help with this...
My understanding is as follows:
CRepositoryInfo::CData::AutoInsert() is called to find/add an
SPerRepositoryInfo() object (basically a {uuid, root} tuple) to data (and
urlIndex, uuidIndex, fullIndex).
It will first call CRepositoryInfo::CData::Lookup() to see if there already
exists an object with the key {uuid, root} by searching fullIndex (and
possibly uuidIndex, urlIndex, depending on the AllowAmbiguousUUID and
AllowAmbiguousURL settings). If it finds something it will return a
pointer, otherwise nullptr.
If Lookup() returns a nullptr, CRepositoryInfo::CData::Add() is called to
create a new SPerRepositoryInfo and to add it to data (and urlIndex,
uuidIndex, fullIndex).
However Add() will "avoid duplicate entries" by searching data
with std::ranges::find_if() and checking for equality using
SPerRepositoryInfo::operator==(). If it finds a duplicate, it will not add
anything to the data/indicies.
AutoInsert() will then try the Lookup() again to find the newly added
object and assumes success since the object was just Add()ed.
Only in my test case the object was NOT added by Add(), since Add() hits
line 176 and returns "to avoid duplicate entries".
I believe there is a difference between the code in Lookup() (using
fullIndex.find(std::make_pair(uuid, root))) and the code in Add()
(using std::ranges::find_if(data, [&](auto* i) { return (*i) == info; })
where the code in Lookup() fail to find an object that is later found by
Add().
However I'm not clever enough to figure out what the difference is. I was
first suspecting that SPerRepositoryInfo::operator==() was too sensitive,
but I figure if that was the case objects would be added even though they
are "duplicate".
I'm currently leaning towards changing CRepositoryInfo::CData::Add(const
SPerRepositoryInfo& info) to return a pointer to the newInfo object, to let
AutoInsert return this instead of doing another Lookup(), but I feel this
would only plaster over the difference between the code in Lookup() and
Add().
I'm also considering reverting r29558 (which added the "avoid duplicate
entries" in Add()) but I'm assuming it was added for good reasons.
Kind regards,
Daniel
--
You received this message because you are subscribed to the Google Groups
"TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tortoisesvn-dev/48e3e330-85ca-4299-9488-8d0a01e15a3fn%40googlegroups.com.