Thread (54 messages) flat view 54 messages, 3 authors, 1d ago

Re: [PATCH v2 3/7] builtin/receive-pack: read unpack limit config lazily

From: Junio C Hamano <hidden>
Date: 2026-08-10 17:54:57

Justin Tobler [off-list ref] writes:
+static int get_unpack_limit(struct repository *repo)
+{
+	static int limit = -1;
+
+	if (limit < 0) {
+		int receive_limit = -1;
+		int transfer_limit = -1;
+
+		repo_config_get_int(repo, "receive.unpacklimit",
+				    &receive_limit);
+		repo_config_get_int(repo, "transfer.unpacklimit",
+				    &transfer_limit);
+
+		if (receive_limit >= 0)
+			limit = receive_limit;
+		else if (transfer_limit >= 0)
+			limit = transfer_limit;
+		else
+			limit = 100;
+	}
+
+	return limit;
+}
I am not sure whether this is progress.

A function that defines a 'static int' internally and sets it only
once is akin to using a global variable.  I wonder whether it would
be too much work to add a new member to either 'repo->settings' or
'repo->config_values' to make the setting truly per-repository.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help