From: Junio C Hamano Date: Fri, 10 Feb 2017 21:04:09 GMT Subject: Re: [PATCH v3] gc: ignore old gc.log files Message-ID: In-Reply-To: <20170210205138.5nnexap32pkbjjrk@sigill.intra.peff.net> Jeff King writes: > I dunno. This seems like a lot of manual scrambling to try to overcome > unlikely errors just to make our stderr heard (and we'd still fail in > some cases). It seems like: > > if (fstat(...)) { > /* weird, fstat failed; try our best to mention it */ > error_errno("unable to fstat gc.log.lock"); > commit_lock_file(&log_lock)); > } else if (st.st_size) { > /* we have new errors to report */ > commit_lock_file(&log_lock); > } else { > /* no new errors; clean up old ones */ > unlink(git_path("gc.log")); > rollback_lock_file(&log_lock); > } > > would be sufficient. Yeah, that should be sufficient.