Skip to content

Commit a89e12d

Browse files
KarthikNayakdscho
authored andcommitted
refs: use 'uint64_t' for 'ref_update.index'
The 'ref_update.index' variable is used to store an index for a given reference update. This index is used to order the updates in a predetermined order, while the default ordering is alphabetical as per the refname. For large repositories with millions of references, it should be safer to use 'uint64_t'. Let's do that. This also is applied for all other code sections where we store 'index' and pass it around. Reported-by: brian m. carlson <[email protected]> Signed-off-by: Karthik Nayak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6638779 commit a89e12d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

refs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ static int ref_transaction_update_reflog(struct ref_transaction *transaction,
12831283
const char *committer_info,
12841284
unsigned int flags,
12851285
const char *msg,
1286-
unsigned int index,
1286+
uint64_t index,
12871287
struct strbuf *err)
12881288
{
12891289
struct ref_update *update;
@@ -2731,7 +2731,7 @@ static int migrate_one_ref(const char *refname, const char *referent UNUSED, con
27312731
}
27322732

27332733
struct reflog_migration_data {
2734-
unsigned int index;
2734+
uint64_t index;
27352735
const char *refname;
27362736
struct ref_store *old_refs;
27372737
struct ref_transaction *transaction;

refs/refs-internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct ref_update {
120120
* when migrating reflogs and we want to ensure we carry over the
121121
* same order.
122122
*/
123-
unsigned int index;
123+
uint64_t index;
124124

125125
/*
126126
* If this ref_update was split off of a symref update via
@@ -203,7 +203,7 @@ struct ref_transaction {
203203
enum ref_transaction_state state;
204204
void *backend_data;
205205
unsigned int flags;
206-
unsigned int max_index;
206+
uint64_t max_index;
207207
};
208208

209209
/*

refs/reftable-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ struct write_transaction_table_arg {
852852
size_t updates_nr;
853853
size_t updates_alloc;
854854
size_t updates_expected;
855-
unsigned int max_index;
855+
uint64_t max_index;
856856
};
857857

858858
struct reftable_transaction_data {

0 commit comments

Comments
 (0)