Commit 28526235ae6336b37d0f79a3c266c3a92587f279

Stefan Sperling 2022-02-13T00:12:04

fix pack.sh test failure from reuse-deltas patch by tweaking progress output

diff --git a/lib/pack_create.c b/lib/pack_create.c
index 126be35..36b6b12 100644
--- a/lib/pack_create.c
+++ b/lib/pack_create.c
@@ -1338,8 +1338,7 @@ static const struct got_error *
 load_object_ids(struct got_object_idset *idset,
     struct got_object_id **theirs, int ntheirs,
     struct got_object_id **ours, int nours, struct got_repository *repo,
-    int loose_obj_only, got_pack_progress_cb progress_cb, void *progress_arg,
-    struct got_ratelimit *rl, got_cancel_cb cancel_cb, void *cancel_arg)
+    int loose_obj_only, got_cancel_cb cancel_cb, void *cancel_arg)
 {
 	const struct got_error *err = NULL;
 	struct got_object_id **ids = NULL;
@@ -1363,11 +1362,6 @@ load_object_ids(struct got_object_idset *idset,
 		    loose_obj_only, cancel_cb, cancel_arg);
 		if (err)
 			goto done;
-		err = report_progress(progress_cb, progress_arg, rl,
-		    0L, nours, got_object_idset_num_elements(idset),
-		    0, 0);
-		if (err)
-			goto done;
 	}
 
 	for (i = 0; i < ntheirs; i++) {
@@ -1388,10 +1382,6 @@ load_object_ids(struct got_object_idset *idset,
 		    loose_obj_only, cancel_cb, cancel_arg);
 		if (err)
 			goto done;
-		err = report_progress(progress_cb, progress_arg, rl,
-		    0L, nours, got_object_idset_num_elements(idset), 0, 0);
-		if (err)
-			goto done;
 	}
 
 	for (i = 0; i < nobj; i++) {
@@ -1399,12 +1389,6 @@ load_object_ids(struct got_object_idset *idset,
 		    loose_obj_only, cancel_cb, cancel_arg);
 		if (err)
 			goto done;
-		if (err)
-			goto done;
-		err = report_progress(progress_cb, progress_arg, rl,
-		    0L, nours, got_object_idset_num_elements(idset), 0, 0);
-		if (err)
-			goto done;
 	}
 
 	for (i = 0; i < nours; i++) {
@@ -1425,17 +1409,6 @@ load_object_ids(struct got_object_idset *idset,
 		    loose_obj_only, cancel_cb, cancel_arg);
 		if (err)
 			goto done;
-		err = report_progress(progress_cb, progress_arg, rl,
-		    0L, nours, got_object_idset_num_elements(idset), 0, 0);
-		if (err)
-			goto done;
-	}
-
-	if (progress_cb) {
-		err = progress_cb(progress_arg, 0L, nours,
-		    got_object_idset_num_elements(idset), 0, 0);
-		if (err)
-			goto done;
 	}
 done:
 	for (i = 0; i < nobj; i++) {
@@ -1795,8 +1768,7 @@ got_pack_create(uint8_t *packsha1, FILE *packfile,
 		return got_error_from_errno("got_object_idset_alloc");
 
 	err = load_object_ids(idset, theirs, ntheirs, ours, nours,
-	    repo, loose_obj_only, progress_cb, progress_arg, &rl,
-	    cancel_cb, cancel_arg);
+	    repo, loose_obj_only, cancel_cb, cancel_arg);
 	if (err)
 		return err;
 
@@ -1805,6 +1777,13 @@ got_pack_create(uint8_t *packsha1, FILE *packfile,
 	if (err)
 		goto done;
 
+	if (progress_cb) {
+		err = progress_cb(progress_arg, 0L, nours,
+		    got_object_idset_num_elements(idset), 0, 0);
+		if (err)
+			goto done;
+	}
+
 	if (got_object_idset_num_elements(idset) == 0 && !allow_empty) {
 		err = got_error(GOT_ERR_CANNOT_PACK);
 		goto done;