commit beb452e226a6110ef7ace94ab1c804f8e5287e04 from: Stefan Sperling via: Thomas Adam date: Sat Jan 28 15:18:01 2023 UTC avoid creation of temporary file if no merged log messages will be used commit - 8279ab8c66b2cff381b52f3b30118c624c93088f commit + beb452e226a6110ef7ace94ab1c804f8e5287e04 blob - ebb83e1f7c48d140c5018cc14b0f4154252b80d6 blob + db215a3dfb509c965b6cad95da9e863781b562eb --- got/got.c +++ got/got.c @@ -8914,9 +8914,7 @@ lookup_logmsg_ref(char **logmsg_path, struct got_pathl TAILQ_INIT(&refs); - err = got_opentemp_named(logmsg_path, &f, "got-commit-logmsg", ""); - if (err) - goto done; + *logmsg_path = NULL; err = got_worktree_get_uuid(&uuidstr, worktree); if (err) @@ -8968,6 +8966,12 @@ lookup_logmsg_ref(char **logmsg_path, struct got_pathl goto done; if (add_logmsg) { + if (f == NULL) { + err = got_opentemp_named(logmsg_path, &f, + "got-commit-logmsg", ""); + if (err) + goto done; + } err = cat_logmsg(f, commit, refname, type, added_logmsg); if (err)