commit 7e320d3b050a09132d29db243fa3940d96707346 from: Mark Jamsek date: Mon Jan 30 05:47:19 2023 UTC got: don't leave tmp "got-logmsg-*" files in the work tree Reported by stsp on irc, and reviewed as part of the following regress commit covering the commit aspect of logmsg refs. Delete temp merge_log files if created during commits involving backed-out/cherrypicked changes. ok stsp@ commit - c167432e009e807556a97fe8c2c74362a726e9a7 commit + 7e320d3b050a09132d29db243fa3940d96707346 blob - 872cc74858a6d9a7d5be7fffffe97fc4f28c9927 blob + 9483d742cf03e1b1222540c193592d1caed4458a --- got/got.c +++ got/got.c @@ -9203,6 +9203,9 @@ done: error == NULL) error = got_error_from_errno2("unlink", cl_arg.logmsg_path); free(cl_arg.logmsg_path); + if (merged_logmsg && unlink(merged_logmsg) == -1 && error == NULL) + error = got_error_from_errno2("unlink", merged_logmsg); + free(merged_logmsg); if (repo) { const struct got_error *close_err = got_repo_close(repo); if (error == NULL)