git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/4] reftable/stack: rename reftable_stack_new_addition()

From
Karthik Nayak <karthik.188@gmail.com>
Date
Aug 24, 2026, 09:31 UTC
Message-ID
<20260824-740-optimize-reloading-the-reftable-stack-v2-2-9c9de2eb0af7@gmail.com>
In-Reply-To
<20260824-740-optimize-reloading-the-reftable-stack-v2-0-9c9de2eb0af7@gmail.com>

Rename the function `reftable_stack_new_addition()` to `reftable_stack_addition_new()` to be more inline with our naming scheme.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 refs/reftable-backend.c         |  4 ++--
 reftable/reftable-stack.h       |  2 +-
 reftable/stack.c                |  4 ++--
 t/unit-tests/u-reftable-stack.c | 10 +++++-----
 4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 5c87fd2d68..73cd794fc6 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -1002,7 +1002,7 @@ static int prepare_transaction_update(struct write_transaction_table_arg **out,
 	if (!arg) {
 		struct reftable_addition *addition;
 
-		ret = reftable_stack_new_addition(&addition, be->stack,
+		ret = reftable_stack_addition_new(&addition, be->stack,
 						  &reftable_be_write_options(refs)->opts);
 		if (ret) {
 			if (ret == REFTABLE_LOCK_ERROR)
@@ -2616,7 +2616,7 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
 	if (ret < 0)
 		goto done;
 
-	ret = reftable_stack_new_addition(&add, be->stack,
+	ret = reftable_stack_addition_new(&add, be->stack,
 					  &reftable_be_write_options(refs)->opts);
 	if (ret < 0)
 		goto done;
diff --git a/reftable/reftable-stack.h b/reftable/reftable-stack.h
index 5d224f8079..875d09d241 100644
--- a/reftable/reftable-stack.h
+++ b/reftable/reftable-stack.h
@@ -62,7 +62,7 @@ struct reftable_addition;
  * returns a new transaction to add reftables to the given stack. As a side
  * effect, the ref database is locked.
  */
-int reftable_stack_new_addition(struct reftable_addition **dest,
+int reftable_stack_addition_new(struct reftable_addition **dest,
 				struct reftable_stack *st,
 				const struct reftable_write_options *opts);
 
diff --git a/reftable/stack.c b/reftable/stack.c
index 540f5e77ac..703548417c 100644
--- a/reftable/stack.c
+++ b/reftable/stack.c
@@ -828,7 +828,7 @@ int reftable_addition_commit(struct reftable_addition *add)
 	return err;
 }
 
-int reftable_stack_new_addition(struct reftable_addition **dest,
+int reftable_stack_addition_new(struct reftable_addition **dest,
 				struct reftable_stack *st,
 				const struct reftable_write_options *opts)
 {
@@ -1826,7 +1826,7 @@ static int reftable_stack_clean_locked(struct reftable_stack *st)
 int reftable_stack_clean(struct reftable_stack *st)
 {
 	struct reftable_addition *add = NULL;
-	int err = reftable_stack_new_addition(&add, st, NULL);
+	int err = reftable_stack_addition_new(&add, st, NULL);
 	if (err < 0) {
 		goto done;
 	}
diff --git a/t/unit-tests/u-reftable-stack.c b/t/unit-tests/u-reftable-stack.c
index c6254190e6..04927113c2 100644
--- a/t/unit-tests/u-reftable-stack.c
+++ b/t/unit-tests/u-reftable-stack.c
@@ -257,7 +257,7 @@ void test_reftable_stack__transaction_api(void)
 
 	reftable_addition_destroy(add);
 
-	cl_assert_equal_i(reftable_stack_new_addition(&add, st, NULL), 0);
+	cl_assert_equal_i(reftable_stack_addition_new(&add, st, NULL), 0);
 	cl_assert_equal_i(reftable_addition_add(add, write_test_ref,
 						&ref), 0);
 	cl_assert_equal_i(reftable_addition_commit(add), 0);
@@ -298,7 +298,7 @@ void test_reftable_stack__transaction_with_reload(void)
 
 	cl_assert_equal_i(reftable_new_stack(&st1, dir, NULL), 0);
 	cl_assert_equal_i(reftable_new_stack(&st2, dir, NULL), 0);
-	cl_assert_equal_i(reftable_stack_new_addition(&add, st1, NULL), 0);
+	cl_assert_equal_i(reftable_stack_addition_new(&add, st1, NULL), 0);
 	cl_assert_equal_i(reftable_addition_add(add, write_test_ref,
 						&refs[0]), 0);
 	cl_assert_equal_i(reftable_addition_commit(add), 0);
@@ -308,7 +308,7 @@ void test_reftable_stack__transaction_with_reload(void)
 	 * The second stack is now outdated, but it should automatically reload it
 	 * with the newer updates.
 	 */
-	cl_assert_equal_i(reftable_stack_new_addition(&add, st2, NULL), 0);
+	cl_assert_equal_i(reftable_stack_addition_new(&add, st2, NULL), 0);
 	cl_assert_equal_i(reftable_addition_add(add, write_test_ref,
 						&refs[1]), 0);
 	cl_assert_equal_i(reftable_addition_commit(add), 0);
@@ -355,7 +355,7 @@ void test_reftable_stack__transaction_api_performs_auto_compaction(void)
 		 * we can ensure that we indeed honor this setting and have
 		 * better control over when exactly auto compaction runs.
 		 */
-		cl_assert_equal_i(reftable_stack_new_addition(&add,
+		cl_assert_equal_i(reftable_stack_addition_new(&add,
 							      st, &write_opts), 0);
 		cl_assert_equal_i(reftable_addition_add(add,
 							write_test_ref, &ref), 0);
@@ -1296,7 +1296,7 @@ void test_reftable_stack__invalid_limit_updates(void)
 
 	reftable_addition_destroy(add);
 
-	cl_assert_equal_i(reftable_stack_new_addition(&add, st, &opts), 0);
+	cl_assert_equal_i(reftable_stack_addition_new(&add, st, &opts), 0);
 
 	/*
 	 * write_limits_after_ref also updates the update indexes after adding
-- 
2.55.GIT
Previous: Karthik NayakNext: Karthik Nayak
Message 3 of 9 in “reftable/stack: avoid reloading the stack when locked”
  1. 0/4 reftable/stack: avoid reloading the stack when lockedKarthik Nayak, Aug 24, 2026
  2. 1/4 reftable/stack: remove `REFTABLE_STACK_NEW_ADDITION_RELOAD`Karthik Nayak, Aug 24, 2026
  3. 2/4 reftable/stack: rename reftable_stack_new_addition()Karthik Nayak, Aug 24, 2026
  4. 3/4 reftable/stack: move list lock to `struct reftable_stack`Karthik Nayak, Aug 24, 2026
  5. Patrick SteinhardtAug 25, 2026
  6. Karthik NayakAug 26, 2026
  7. 4/4 reftable/stack: avoid reloading the stack when already lockedKarthik Nayak, Aug 24, 2026
  8. Jeff KingAug 24, 2026
  9. Karthik NayakAug 26, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.