Commit Diff


commit - fe354d70d4ad218c599cac447058537d734836e5
commit + 8d5493c9d912382b91a5a5ac9f25351040078e02
blob - 2f26d13b606488dfcb50b4273bb71e143d93b757
blob + 14381993fce1ddf1ccb7eba95347a6f3f2a79510
--- tog/tog.c
+++ tog/tog.c
@@ -10770,14 +10770,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();