the .get() like behaviour (== returning the value) was missing.
it's still not 100% like dict.setdefault, because there is no
default value None. but None doesn't make sense here, because we
usually need a N-tuple matching the hash table's value format.
note: this "bug" (or unusual implementation) was without consequences,
because hashindex.setdefault is not used anywhere in borg, so
it was also not used in a wrong way anywhere.
https://docs.python.org/3/library/stdtypes.html#dict.setdefault
docs:borg init: explain the encryption modes better
The documentation for borg init was not structured logically:
1. The topic is switched from the general discussion of `borg init`
to the discussion of encryption modes without a title.
2. Obscure technical details (chunking, id generation etc) were
above the high-level overview and other key information.
https://github.com/borgbackup/borg/pull/6188#discussion_r794752672
> Well, guess one could also use max(list of trusted nonce values).
>
> The real issue is if you have lost all or some of the trusted
> (client side) nonce values and you also have reason to not trust the
> server side nonce, because someone might attack you on the server.
I am about to add documentation for this feature. Per the "If you liked
it, you should have put a CI test on it" rule I am adding tests to
detect if the feature regresses (causing a discrepancy between the docs
and the real behavior).
If we create a new repo (and a new keyfile key, create=True),
there must not already exist a keyfile at the path/filename
where we want to write the new one.
In other use cases (e.g. if we overwrite a keyfile due
to the user changing their passphrase, create=False),
of course overwriting at the same path/fname is desired.
compact_segments produced separate 17b files for intermediate commits, although they were intended to be end-of-segment-file commits.
this is because when the intermediate commit is triggered, we are already at an offset beyond the limit.
thus needed to add the no_new flag to indicate that we do not want a new segment file just for the commit IF it is an intermediate commit.