Subject: Re: Making split commit graphs pick up new options (namely --changed-paths)

From: Junio C Hamano <[email-masked]>
Date: Wed, 16 Jun 2021 10:45:03 +0900

Ævar Arnfjörð Bjarmason <[email-masked]> writes:

> ... indeed unlinking a file you just created (but hold a FD
> to) is a common pattern for getting a temporary file that you don't need
> to unlink on atexit(). It's just not used in e.g. Git's codebase because
> of portability concerns.

Do we open one r/w, write into it and later read back from it,
without wanting the file to persist after we exit?  That is more
suitable for say Editor's "swp" file but I do not think of an
instance of our use of temporary file that would benefit from that
pattern.  IOW, it's not used in our codebase because we have no need
for the pattern, not due to portability concerns.

But that distinction is not the primary point in this topic.

> So not a big deal at all, but I wonder if there should be a warning
> there on !Windows, if you can't unlink a file on a POSIX system that
> suggests e.g. a persistent permission problem that won't be going away
> if you ignore it.

I do think we should catch failure from unlink and probably should
error out, unless we anticipate that somebody else might be removing
the same file and we got ENOENT.