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

From:
Florian Obser <florian@narrans.de>
Subject:
got send progress
To:
gameoftrees <gameoftrees@openbsd.org>
Date:
Thu, 21 Jul 2022 17:46:59 +0200

Download raw body.

Thread
I can't quite figure out if there is a case where we are not updating
progress even with the fix. Maybe we can just drop bytes_sent_cur and
always update, that's what the code is currently doing anyway.

commit 3aca477f3fb4dba6ff0f1723d4b687cd2daa1764
Author: Florian Obser <florian@narrans.de>
Date:   Thu Jul 21 14:41:22 2022 +0200

    Correctly track if we sent more data since the last time we looked.
    
    With the narrow scope of bytes_sent_cur it would always be zero, and
    we would always update progress.
    
    Found by llvm's scan-build (Dead store).

diff --git lib/send.c lib/send.c
index b8290d0d..69f2244f 100644
--- lib/send.c
+++ lib/send.c
@@ -342,7 +342,7 @@ got_send_pack(const char *remote_name, struct got_pathlist_head *branch_names,
 	int i, nours = 0, ntheirs = 0;
 	size_t nalloc_ours = 0, nalloc_theirs = 0;
 	int refs_to_send = 0, refs_to_delete = 0;
-	off_t bytes_sent = 0;
+	off_t bytes_sent = 0, bytes_sent_cur = 0;
 	struct pack_progress_arg ppa;
 	uint8_t packsha1[SHA1_DIGEST_LENGTH];
 	FILE *packfile = NULL;
@@ -665,7 +665,6 @@ got_send_pack(const char *remote_name, struct got_pathlist_head *branch_names,
 	while (!done) {
 		int success = 0;
 		char *refname = NULL;
-		off_t bytes_sent_cur = 0;
 		if (cancel_cb) {
 			err = (*cancel_cb)(cancel_arg);
 			if (err)

-- 
I'm not entirely sure you are real.