"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
tog: don't clobber ref view error with repo close error
To:
gameoftrees@openbsd.org
Date:
Wed, 01 Jan 2025 01:03:54 +1100

Download raw body.

Thread
Spotted by chance: we clobber any existing ref view error when
got_repo_close() returns an error result. And I couldn't help
but style(9) the next block while there.

ok?

commit efacf84de1008a76985f85f053e1a5927e5ba71c
from: Mark Jamsek <mark@jamsek.dev>
date: Tue Dec 31 13:34:50 2024 UTC

tog: don't clobber error with got_repo_close() error

While here, style(9) the adjacent block: remove function call from initializer.

M  tog/tog.c  |  8+  5-

1 file changed, 8 insertions(+), 5 deletions(-)

commit - 2c8b63a98d2947916371cad08ebb122d06b1d024
commit + efacf84de1008a76985f85f053e1a5927e5ba71c
blob - 8d227eff283fc8287e36b66f666eb4a49d584018
blob + 4eb0e6acc9ff0cfb7f844d192808a181c12ecfec
--- tog/tog.c
+++ tog/tog.c
@@ -10766,14 +10766,17 @@ done:
 	if (worktree != NULL)
 		got_worktree_close(worktree);
 	if (repo) {
-		const struct got_error *close_err = got_repo_close(repo);
-		if (close_err)
+		const struct got_error *close_err;
+
+		close_err = got_repo_close(repo);
+		if (close_err && error == NULL)
 			error = close_err;
 	}
 	if (pack_fds) {
-		const struct got_error *pack_err =
-		    got_repo_pack_fds_close(pack_fds);
-		if (error == NULL)
+		const struct got_error *pack_err;
+
+		pack_err = got_repo_pack_fds_close(pack_fds);
+		if (pack_err && error == NULL)
 			error = pack_err;
 	}
 	tog_free_refs();


-- 
Mark Jamsek <https://bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68