On Thu, Jul 07, 2022 at 04:17:08PM +0100, Ramsay Jones wrote: > Also, I would like to understand why the code is written as it is > currently. I'm sure there must be a good reason - I just don't know > what it is! I suspect (ie I'm guessing), it has something to do with > operating in a high contention context [TOCTOU on socket?] ... dunno. ;-) By the way, I was slightly surprised you did not find the explanation in the commit history. A blame[1] of credential-cache--daemon.c shows that the comment was added by 7d5e9c9849 (credential-cache--daemon: clarify "exit" action semantics, 2016-03-18) which mentions the race in the tests. And then searching for that commit message in the list yields the thread I linked earlier with more context[2]. I mention this not as a criticism, because your digging for backstory was otherwise quite thorough. It's only _because_ it was so thorough that I was surprised you didn't find that commit. ;) So I offer it only as a suggestion for future digging. -Peff [1] Likewise this works: git log --follow -S'important that we clean up' builtin/credential-cache--daemon.c but the --follow is necessary because of the rename when it became a builtin. It's cool that "blame" handles this seamlessly. :) [2] Finding the original patch on the list is my go-to trick when a commit message hasn't sufficiently explained things. I know Junio was for a while (is still?) kept a git-notes mapping of commits to emails. In practice, I usually just do a manual search for a few unique-looking phrases from the commit message. That should be pretty easy with lore these days, though I do it with a local archive indexed by notmuch. -Peff