Skip to content

Commit 98bb796

Browse files
ttaylorrgitster
authored andcommitted
commit-graph: rename 'split_commit_graph_opts'
In the subsequent commit, additional options will be added to the commit-graph API which have nothing to do with splitting. Rename the 'split_commit_graph_opts' structure to the more-generic 'commit_graph_opts' to encompass both. Likewise, rename the 'flags' member to instead be 'split_flags' to clarify that it only has to do with the behavior implied by '--split'. Suggested-by: Derrick Stolee <[email protected]> Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 59f0d50 commit 98bb796

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

builtin/commit-graph.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static int graph_verify(int argc, const char **argv)
119119
}
120120

121121
extern int read_replace_refs;
122-
static struct split_commit_graph_opts split_opts;
122+
static struct commit_graph_opts write_opts;
123123

124124
static int write_option_parse_split(const struct option *opt, const char *arg,
125125
int unset)
@@ -187,24 +187,24 @@ static int graph_write(int argc, const char **argv)
187187
OPT_BOOL(0, "changed-paths", &opts.enable_changed_paths,
188188
N_("enable computation for changed paths")),
189189
OPT_BOOL(0, "progress", &opts.progress, N_("force progress reporting")),
190-
OPT_CALLBACK_F(0, "split", &split_opts.flags, NULL,
190+
OPT_CALLBACK_F(0, "split", &write_opts.split_flags, NULL,
191191
N_("allow writing an incremental commit-graph file"),
192192
PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
193193
write_option_parse_split),
194-
OPT_INTEGER(0, "max-commits", &split_opts.max_commits,
194+
OPT_INTEGER(0, "max-commits", &write_opts.max_commits,
195195
N_("maximum number of commits in a non-base split commit-graph")),
196-
OPT_INTEGER(0, "size-multiple", &split_opts.size_multiple,
196+
OPT_INTEGER(0, "size-multiple", &write_opts.size_multiple,
197197
N_("maximum ratio between two levels of a split commit-graph")),
198-
OPT_EXPIRY_DATE(0, "expire-time", &split_opts.expire_time,
198+
OPT_EXPIRY_DATE(0, "expire-time", &write_opts.expire_time,
199199
N_("only expire files older than a given date-time")),
200200
OPT_END(),
201201
};
202202

203203
opts.progress = isatty(2);
204204
opts.enable_changed_paths = -1;
205-
split_opts.size_multiple = 2;
206-
split_opts.max_commits = 0;
207-
split_opts.expire_time = 0;
205+
write_opts.size_multiple = 2;
206+
write_opts.max_commits = 0;
207+
write_opts.expire_time = 0;
208208

209209
trace2_cmd_mode("write");
210210

@@ -232,7 +232,7 @@ static int graph_write(int argc, const char **argv)
232232
odb = find_odb(the_repository, opts.obj_dir);
233233

234234
if (opts.reachable) {
235-
if (write_commit_graph_reachable(odb, flags, &split_opts))
235+
if (write_commit_graph_reachable(odb, flags, &write_opts))
236236
return 1;
237237
return 0;
238238
}
@@ -261,7 +261,7 @@ static int graph_write(int argc, const char **argv)
261261
opts.stdin_packs ? &pack_indexes : NULL,
262262
opts.stdin_commits ? &commits : NULL,
263263
flags,
264-
&split_opts))
264+
&write_opts))
265265
result = 1;
266266

267267
cleanup:

commit-graph.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ struct write_commit_graph_context {
962962
changed_paths:1,
963963
order_by_pack:1;
964964

965-
const struct split_commit_graph_opts *split_opts;
965+
const struct commit_graph_opts *opts;
966966
size_t total_bloom_filter_data_size;
967967
const struct bloom_filter_settings *bloom_settings;
968968

@@ -1286,8 +1286,8 @@ static void close_reachable(struct write_commit_graph_context *ctx)
12861286
{
12871287
int i;
12881288
struct commit *commit;
1289-
enum commit_graph_split_flags flags = ctx->split_opts ?
1290-
ctx->split_opts->flags : COMMIT_GRAPH_SPLIT_UNSPECIFIED;
1289+
enum commit_graph_split_flags flags = ctx->opts ?
1290+
ctx->opts->split_flags : COMMIT_GRAPH_SPLIT_UNSPECIFIED;
12911291

12921292
if (ctx->report_progress)
12931293
ctx->progress = start_delayed_progress(
@@ -1476,7 +1476,7 @@ static int add_ref_to_set(const char *refname,
14761476

14771477
int write_commit_graph_reachable(struct object_directory *odb,
14781478
enum commit_graph_write_flags flags,
1479-
const struct split_commit_graph_opts *split_opts)
1479+
const struct commit_graph_opts *opts)
14801480
{
14811481
struct oidset commits = OIDSET_INIT;
14821482
struct refs_cb_data data;
@@ -1493,7 +1493,7 @@ int write_commit_graph_reachable(struct object_directory *odb,
14931493
stop_progress(&data.progress);
14941494

14951495
result = write_commit_graph(odb, NULL, &commits,
1496-
flags, split_opts);
1496+
flags, opts);
14971497

14981498
oidset_clear(&commits);
14991499
return result;
@@ -1608,8 +1608,8 @@ static uint32_t count_distinct_commits(struct write_commit_graph_context *ctx)
16081608
static void copy_oids_to_commits(struct write_commit_graph_context *ctx)
16091609
{
16101610
uint32_t i;
1611-
enum commit_graph_split_flags flags = ctx->split_opts ?
1612-
ctx->split_opts->flags : COMMIT_GRAPH_SPLIT_UNSPECIFIED;
1611+
enum commit_graph_split_flags flags = ctx->opts ?
1612+
ctx->opts->split_flags : COMMIT_GRAPH_SPLIT_UNSPECIFIED;
16131613

16141614
ctx->num_extra_edges = 0;
16151615
if (ctx->report_progress)
@@ -1894,13 +1894,13 @@ static void split_graph_merge_strategy(struct write_commit_graph_context *ctx)
18941894
int max_commits = 0;
18951895
int size_mult = 2;
18961896

1897-
if (ctx->split_opts) {
1898-
max_commits = ctx->split_opts->max_commits;
1897+
if (ctx->opts) {
1898+
max_commits = ctx->opts->max_commits;
18991899

1900-
if (ctx->split_opts->size_multiple)
1901-
size_mult = ctx->split_opts->size_multiple;
1900+
if (ctx->opts->size_multiple)
1901+
size_mult = ctx->opts->size_multiple;
19021902

1903-
flags = ctx->split_opts->flags;
1903+
flags = ctx->opts->split_flags;
19041904
}
19051905

19061906
g = ctx->r->objects->commit_graph;
@@ -2078,8 +2078,8 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
20782078
size_t dirnamelen;
20792079
timestamp_t expire_time = time(NULL);
20802080

2081-
if (ctx->split_opts && ctx->split_opts->expire_time)
2082-
expire_time = ctx->split_opts->expire_time;
2081+
if (ctx->opts && ctx->opts->expire_time)
2082+
expire_time = ctx->opts->expire_time;
20832083
if (!ctx->split) {
20842084
char *chain_file_name = get_chain_filename(ctx->odb);
20852085
unlink(chain_file_name);
@@ -2130,7 +2130,7 @@ int write_commit_graph(struct object_directory *odb,
21302130
struct string_list *pack_indexes,
21312131
struct oidset *commits,
21322132
enum commit_graph_write_flags flags,
2133-
const struct split_commit_graph_opts *split_opts)
2133+
const struct commit_graph_opts *opts)
21342134
{
21352135
struct write_commit_graph_context *ctx;
21362136
uint32_t i, count_distinct = 0;
@@ -2147,7 +2147,7 @@ int write_commit_graph(struct object_directory *odb,
21472147
ctx->append = flags & COMMIT_GRAPH_WRITE_APPEND ? 1 : 0;
21482148
ctx->report_progress = flags & COMMIT_GRAPH_WRITE_PROGRESS ? 1 : 0;
21492149
ctx->split = flags & COMMIT_GRAPH_WRITE_SPLIT ? 1 : 0;
2150-
ctx->split_opts = split_opts;
2150+
ctx->opts = opts;
21512151
ctx->total_bloom_filter_data_size = 0;
21522152

21532153
bloom_settings.bits_per_entry = git_env_ulong("GIT_TEST_BLOOM_SETTINGS_BITS_PER_ENTRY",
@@ -2195,15 +2195,15 @@ int write_commit_graph(struct object_directory *odb,
21952195
}
21962196
}
21972197

2198-
if (ctx->split_opts)
2199-
replace = ctx->split_opts->flags & COMMIT_GRAPH_SPLIT_REPLACE;
2198+
if (ctx->opts)
2199+
replace = ctx->opts->split_flags & COMMIT_GRAPH_SPLIT_REPLACE;
22002200
}
22012201

22022202
ctx->approx_nr_objects = approximate_object_count();
22032203
ctx->oids.alloc = ctx->approx_nr_objects / 32;
22042204

2205-
if (ctx->split && split_opts && ctx->oids.alloc > split_opts->max_commits)
2206-
ctx->oids.alloc = split_opts->max_commits;
2205+
if (ctx->split && opts && ctx->oids.alloc > opts->max_commits)
2206+
ctx->oids.alloc = opts->max_commits;
22072207

22082208
if (ctx->append) {
22092209
prepare_commit_graph_one(ctx->r, ctx->odb);

commit-graph.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ enum commit_graph_split_flags {
105105
COMMIT_GRAPH_SPLIT_REPLACE = 2
106106
};
107107

108-
struct split_commit_graph_opts {
108+
struct commit_graph_opts {
109109
int size_multiple;
110110
int max_commits;
111111
timestamp_t expire_time;
112-
enum commit_graph_split_flags flags;
112+
enum commit_graph_split_flags split_flags;
113113
};
114114

115115
/*
@@ -120,12 +120,12 @@ struct split_commit_graph_opts {
120120
*/
121121
int write_commit_graph_reachable(struct object_directory *odb,
122122
enum commit_graph_write_flags flags,
123-
const struct split_commit_graph_opts *split_opts);
123+
const struct commit_graph_opts *opts);
124124
int write_commit_graph(struct object_directory *odb,
125125
struct string_list *pack_indexes,
126126
struct oidset *commits,
127127
enum commit_graph_write_flags flags,
128-
const struct split_commit_graph_opts *split_opts);
128+
const struct commit_graph_opts *opts);
129129

130130
#define COMMIT_GRAPH_VERIFY_SHALLOW (1 << 0)
131131

0 commit comments

Comments
 (0)