diff mbox series

[1/3] refs: mark `ref_transaction_update_reflog()` as static

Message ID 20250117-461-corrupted-reftable-followup-v1-1-70ee605ae3fe@gmail.com (mailing list archive)
State Superseded
Headers show
Series refs: small followups to the migration corruption fix | expand

Commit Message

Karthik Nayak Jan. 17, 2025, 7:59 a.m. UTC
The `ref_transaction_update_reflog()` function is only used within
'refs.c', so mark it as static.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
 refs.c | 16 +++++++++-------
 refs.h | 14 --------------
 2 files changed, 9 insertions(+), 21 deletions(-)

Comments

Patrick Steinhardt Jan. 17, 2025, 9:29 a.m. UTC | #1
On Fri, Jan 17, 2025 at 08:59:12AM +0100, Karthik Nayak wrote:
> diff --git a/refs.h b/refs.h
> index a0cdd99250e8286b55808b697b0a94afac5d8319..09be47afbee51e99f4ae49588cd65596ccfcb07e 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -771,20 +771,6 @@ int ref_transaction_update(struct ref_transaction *transaction,
>  			   unsigned int flags, const char *msg,
>  			   struct strbuf *err);
>  
> -/*
> - * Similar to`ref_transaction_update`, but this function is only for adding
> - * a reflog update. Supports providing custom committer information. The index
> - * field can be utiltized to order updates as desired. When not used, the
> - * updates default to being ordered by refname.
> - */

Do we maybe want to move the comment over? The explanation of the index
field seems useful to me.

Patrick

> -int ref_transaction_update_reflog(struct ref_transaction *transaction,
> -				  const char *refname,
> -				  const struct object_id *new_oid,
> -				  const struct object_id *old_oid,
> -				  const char *committer_info, unsigned int flags,
> -				  const char *msg, unsigned int index,
> -				  struct strbuf *err);
> -
>  /*
>   * Add a reference creation to transaction. new_oid is the value that
>   * the reference should have after the update; it must not be
Karthik Nayak Jan. 20, 2025, 11:17 a.m. UTC | #2
Patrick Steinhardt <ps@pks.im> writes:

> On Fri, Jan 17, 2025 at 08:59:12AM +0100, Karthik Nayak wrote:
>> diff --git a/refs.h b/refs.h
>> index a0cdd99250e8286b55808b697b0a94afac5d8319..09be47afbee51e99f4ae49588cd65596ccfcb07e 100644
>> --- a/refs.h
>> +++ b/refs.h
>> @@ -771,20 +771,6 @@ int ref_transaction_update(struct ref_transaction *transaction,
>>  			   unsigned int flags, const char *msg,
>>  			   struct strbuf *err);
>>
>> -/*
>> - * Similar to`ref_transaction_update`, but this function is only for adding
>> - * a reflog update. Supports providing custom committer information. The index
>> - * field can be utiltized to order updates as desired. When not used, the
>> - * updates default to being ordered by refname.
>> - */
>
> Do we maybe want to move the comment over? The explanation of the index
> field seems useful to me.
>

Yeah, that'd be useful indeed, let me move it.

> Patrick
>
>> -int ref_transaction_update_reflog(struct ref_transaction *transaction,
>> -				  const char *refname,
>> -				  const struct object_id *new_oid,
>> -				  const struct object_id *old_oid,
>> -				  const char *committer_info, unsigned int flags,
>> -				  const char *msg, unsigned int index,
>> -				  struct strbuf *err);
>> -
>>  /*
>>   * Add a reference creation to transaction. new_oid is the value that
>>   * the reference should have after the update; it must not be
diff mbox series

Patch

diff --git a/refs.c b/refs.c
index f7b6f0f897eb58665e10a2efd3eb53c3f72abe61..1bb6f0356d5c5cae8bea9d6f4d5ff35164a03c64 100644
--- a/refs.c
+++ b/refs.c
@@ -1318,13 +1318,15 @@  int ref_transaction_update(struct ref_transaction *transaction,
 	return 0;
 }
 
-int ref_transaction_update_reflog(struct ref_transaction *transaction,
-				  const char *refname,
-				  const struct object_id *new_oid,
-				  const struct object_id *old_oid,
-				  const char *committer_info, unsigned int flags,
-				  const char *msg, unsigned int index,
-				  struct strbuf *err)
+static int ref_transaction_update_reflog(struct ref_transaction *transaction,
+					 const char *refname,
+					 const struct object_id *new_oid,
+					 const struct object_id *old_oid,
+					 const char *committer_info,
+					 unsigned int flags,
+					 const char *msg,
+					 unsigned int index,
+					 struct strbuf *err)
 {
 	struct ref_update *update;
 
diff --git a/refs.h b/refs.h
index a0cdd99250e8286b55808b697b0a94afac5d8319..09be47afbee51e99f4ae49588cd65596ccfcb07e 100644
--- a/refs.h
+++ b/refs.h
@@ -771,20 +771,6 @@  int ref_transaction_update(struct ref_transaction *transaction,
 			   unsigned int flags, const char *msg,
 			   struct strbuf *err);
 
-/*
- * Similar to`ref_transaction_update`, but this function is only for adding
- * a reflog update. Supports providing custom committer information. The index
- * field can be utiltized to order updates as desired. When not used, the
- * updates default to being ordered by refname.
- */
-int ref_transaction_update_reflog(struct ref_transaction *transaction,
-				  const char *refname,
-				  const struct object_id *new_oid,
-				  const struct object_id *old_oid,
-				  const char *committer_info, unsigned int flags,
-				  const char *msg, unsigned int index,
-				  struct strbuf *err);
-
 /*
  * Add a reference creation to transaction. new_oid is the value that
  * the reference should have after the update; it must not be