Duy Nguyen <pclouds@xxxxxxxxx> writes: > We do keep another lock before coming to opening this log file. So > once we get here we already know nobody else will be opening the log > file. We can simply open it the normal way, then make sure we clean it > up at atexit(). > >>> This doesn't seem like a common thing to want (as in, this might be the >>> only caller), but it probably makes sense to build it into the >>> tempfile/lockfile API nevertheless, because implementing it externally >>> would require a lot of other code to be duplicated. >>> >>> Another possibility that might work (maybe without requiring changes to >>> tempfile/lockfile): don't worry about deleting the log file if it is >>> empty, but make observers treat an empty log file the same as an absent one. >> >> Probably your "don't remove and check for emptiness" approach would >> be the simpler of the two, but I think we can go either way. > > People have complained to me about stray files in $GIT_DIR, so it's > probably best that we delete empty/useless files. Although we could > delete empty files at the beginning of the next gc instead of at > atexit(). Let me try it out and see which is simplest. It would be nicer if we did not have to do an extra and custom atexit() handler. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html