Commit ea7396b906790eb988c713e93d2444993fd370e8

Stefan Sperling 2020-03-18T16:11:32

rename imsg FETCH_PROGRESS to FETCH_REF

diff --git a/lib/got_lib_privsep.h b/lib/got_lib_privsep.h
index 9b2faf4..5b5d6f6 100644
--- a/lib/got_lib_privsep.h
+++ b/lib/got_lib_privsep.h
@@ -111,7 +111,7 @@ enum got_imsg_type {
 	/* Messages related to networking. */
 	GOT_IMSG_FETCH_REQUEST,
 	GOT_IMSG_FETCH_SYMREFS,
-	GOT_IMSG_FETCH_PROGRESS,
+	GOT_IMSG_FETCH_REF,
 	GOT_IMSG_FETCH_SERVER_PROGRESS,
 	GOT_IMSG_FETCH_DONE,
 	GOT_IMSG_IDXPACK_REQUEST,
@@ -262,8 +262,8 @@ struct got_imsg_fetch_symrefs {
 	/* Followed by nsymrefs times of got_imsg_fetch_symref data. */
 } __attribute__((__packed__));
 
-/* Structure for GOT_IMSG_FETCH_PROGRESS data. */
-struct got_imsg_fetch_progress {
+/* Structure for GOT_IMSG_FETCH_REF data. */
+struct got_imsg_fetch_ref {
 	/* Describes a reference which will be fetched. */
 	uint8_t refid[SHA1_DIGEST_LENGTH];
 	/* Followed by reference name in remaining data of imsg buffer. */
@@ -355,7 +355,7 @@ const struct got_error *got_privsep_send_fetch_req(struct imsgbuf *, int,
     struct got_pathlist_head *);
 const struct got_error *got_privsep_send_fetch_symrefs(struct imsgbuf *,
     struct got_pathlist_head *);
-const struct got_error *got_privsep_send_fetch_progress(struct imsgbuf *,
+const struct got_error *got_privsep_send_fetch_ref(struct imsgbuf *,
     struct got_object_id *, const char *);
 const struct got_error *got_privsep_send_fetch_server_progress(struct imsgbuf *,
     const char *, size_t);
diff --git a/lib/privsep.c b/lib/privsep.c
index bbd1527..6aabc63 100644
--- a/lib/privsep.c
+++ b/lib/privsep.c
@@ -537,29 +537,29 @@ got_privsep_send_fetch_symrefs(struct imsgbuf *ibuf,
 }
 
 const struct got_error *
-got_privsep_send_fetch_progress(struct imsgbuf *ibuf,
+got_privsep_send_fetch_ref(struct imsgbuf *ibuf,
     struct got_object_id *refid, const char *refname)
 {
 	const struct got_error *err = NULL;
 	struct ibuf *wbuf;
 	size_t len, reflen = strlen(refname);
 
-	len = sizeof(struct got_imsg_fetch_progress) + reflen;
+	len = sizeof(struct got_imsg_fetch_ref) + reflen;
 	if (len >= MAX_IMSGSIZE - IMSG_HEADER_SIZE)
 		return got_error(GOT_ERR_NO_SPACE);
 
-	wbuf = imsg_create(ibuf, GOT_IMSG_FETCH_PROGRESS, 0, 0, len);
+	wbuf = imsg_create(ibuf, GOT_IMSG_FETCH_REF, 0, 0, len);
 	if (wbuf == NULL)
-		return got_error_from_errno("imsg_create FETCH_PROGRESS");
+		return got_error_from_errno("imsg_create FETCH_REF");
 
-	/* Keep in sync with struct got_imsg_fetch_progress definition! */
+	/* Keep in sync with struct got_imsg_fetch_ref definition! */
 	if (imsg_add(wbuf, refid->sha1, SHA1_DIGEST_LENGTH) == -1) {
-		err = got_error_from_errno("imsg_add FETCH_PROGRESS");
+		err = got_error_from_errno("imsg_add FETCH_REF");
 		ibuf_free(wbuf);
 		return err;
 	}
 	if (imsg_add(wbuf, refname, reflen) == -1) {
-		err = got_error_from_errno("imsg_add FETCH_PROGRESS");
+		err = got_error_from_errno("imsg_add FETCH_REF");
 		ibuf_free(wbuf);
 		return err;
 	}
@@ -682,7 +682,7 @@ got_privsep_recv_fetch_progress(int *done, struct got_object_id **id,
 			}
 		}
 		break;
-	case GOT_IMSG_FETCH_PROGRESS:
+	case GOT_IMSG_FETCH_REF:
 		if (datalen <= SHA1_DIGEST_LENGTH) {
 			err = got_error(GOT_ERR_PRIVSEP_MSG);
 			break;
diff --git a/libexec/got-fetch-pack/got-fetch-pack.c b/libexec/got-fetch-pack/got-fetch-pack.c
index 40fbe8e..e2d60c1 100644
--- a/libexec/got-fetch-pack/got-fetch-pack.c
+++ b/libexec/got-fetch-pack/got-fetch-pack.c
@@ -584,7 +584,7 @@ fetch_pack(int fd, int packfd, struct got_object_id *packid,
 		if (err)
 			goto done;
 
-		err = got_privsep_send_fetch_progress(ibuf, &want[nref],
+		err = got_privsep_send_fetch_ref(ibuf, &want[nref],
 		    refname);
 		if (err)
 			goto done;