Merge branch 'jk/drop-unused-parameters'

Drop unused parameters from functions.

* jk/drop-unused-parameters:
  diff-lib: drop unused index argument from get_stat_data()
  ref-filter: drop unused parameters from email_atom_option_parser()
  pack-bitmap: drop unused parameters from select_pseudo_merges()
  pack-bitmap: load writer config from repository parameter
  refs: drop some unused parameters from create_symref_lock()
maint
Junio C Hamano 2024-08-26 11:32:21 -07:00
commit 2ff26d2286
6 changed files with 18 additions and 25 deletions

View File

@ -308,8 +308,7 @@ static void diff_index_show_file(struct rev_info *revs,
oid, oid_valid, ce->name, dirty_submodule); oid, oid_valid, ce->name, dirty_submodule);
} }


static int get_stat_data(const struct index_state *istate, static int get_stat_data(const struct cache_entry *ce,
const struct cache_entry *ce,
const struct object_id **oidp, const struct object_id **oidp,
unsigned int *modep, unsigned int *modep,
int cached, int match_missing, int cached, int match_missing,
@ -352,7 +351,6 @@ static void show_new_file(struct rev_info *revs,
const struct object_id *oid; const struct object_id *oid;
unsigned int mode; unsigned int mode;
unsigned dirty_submodule = 0; unsigned dirty_submodule = 0;
struct index_state *istate = revs->diffopt.repo->index;


if (new_file && S_ISSPARSEDIR(new_file->ce_mode)) { if (new_file && S_ISSPARSEDIR(new_file->ce_mode)) {
diff_tree_oid(NULL, &new_file->oid, new_file->name, &revs->diffopt); diff_tree_oid(NULL, &new_file->oid, new_file->name, &revs->diffopt);
@ -363,7 +361,7 @@ static void show_new_file(struct rev_info *revs,
* New file in the index: it might actually be different in * New file in the index: it might actually be different in
* the working tree. * the working tree.
*/ */
if (get_stat_data(istate, new_file, &oid, &mode, cached, match_missing, if (get_stat_data(new_file, &oid, &mode, cached, match_missing,
&dirty_submodule, &revs->diffopt) < 0) &dirty_submodule, &revs->diffopt) < 0)
return; return;


@ -379,7 +377,6 @@ static int show_modified(struct rev_info *revs,
unsigned int mode, oldmode; unsigned int mode, oldmode;
const struct object_id *oid; const struct object_id *oid;
unsigned dirty_submodule = 0; unsigned dirty_submodule = 0;
struct index_state *istate = revs->diffopt.repo->index;


assert(S_ISSPARSEDIR(old_entry->ce_mode) == assert(S_ISSPARSEDIR(old_entry->ce_mode) ==
S_ISSPARSEDIR(new_entry->ce_mode)); S_ISSPARSEDIR(new_entry->ce_mode));
@ -395,7 +392,7 @@ static int show_modified(struct rev_info *revs,
return 0; return 0;
} }


if (get_stat_data(istate, new_entry, &oid, &mode, cached, match_missing, if (get_stat_data(new_entry, &oid, &mode, cached, match_missing,
&dirty_submodule, &revs->diffopt) < 0) { &dirty_submodule, &revs->diffopt) < 0) {
if (report_missing) if (report_missing)
diff_index_show_file(revs, "-", old_entry, diff_index_show_file(revs, "-", old_entry,

View File

@ -53,7 +53,7 @@ void bitmap_writer_init(struct bitmap_writer *writer, struct repository *r,


string_list_init_dup(&writer->pseudo_merge_groups); string_list_init_dup(&writer->pseudo_merge_groups);


load_pseudo_merges_from_config(&writer->pseudo_merge_groups); load_pseudo_merges_from_config(r, &writer->pseudo_merge_groups);
} }


static void free_pseudo_merge_commit_idx(struct pseudo_merge_commit_idx *idx) static void free_pseudo_merge_commit_idx(struct pseudo_merge_commit_idx *idx)
@ -695,8 +695,7 @@ void bitmap_writer_select_commits(struct bitmap_writer *writer,
for (i = 0; i < indexed_commits_nr; ++i) for (i = 0; i < indexed_commits_nr; ++i)
bitmap_writer_push_commit(writer, indexed_commits[i], 0); bitmap_writer_push_commit(writer, indexed_commits[i], 0);


select_pseudo_merges(writer, indexed_commits, select_pseudo_merges(writer);
indexed_commits_nr);


return; return;
} }
@ -738,7 +737,7 @@ void bitmap_writer_select_commits(struct bitmap_writer *writer,


stop_progress(&writer->progress); stop_progress(&writer->progress);


select_pseudo_merges(writer, indexed_commits, indexed_commits_nr); select_pseudo_merges(writer);
} }





View File

@ -183,11 +183,12 @@ done:
return ret; return ret;
} }


void load_pseudo_merges_from_config(struct string_list *list) void load_pseudo_merges_from_config(struct repository *r,
struct string_list *list)
{ {
struct string_list_item *item; struct string_list_item *item;


git_config(pseudo_merge_config, list); repo_config(r, pseudo_merge_config, list);


for_each_string_list_item(item, list) { for_each_string_list_item(item, list) {
struct pseudo_merge_group *group = item->util; struct pseudo_merge_group *group = item->util;
@ -429,8 +430,7 @@ static void sort_pseudo_merge_matches(struct pseudo_merge_matches *matches)
QSORT(matches->unstable, matches->unstable_nr, commit_date_cmp); QSORT(matches->unstable, matches->unstable_nr, commit_date_cmp);
} }


void select_pseudo_merges(struct bitmap_writer *writer, void select_pseudo_merges(struct bitmap_writer *writer)
struct commit **commits, size_t commits_nr)
{ {
struct progress *progress = NULL; struct progress *progress = NULL;
uint32_t i; uint32_t i;

View File

@ -10,6 +10,7 @@ struct commit;
struct string_list; struct string_list;
struct bitmap_index; struct bitmap_index;
struct bitmap_writer; struct bitmap_writer;
struct repository;


/* /*
* A pseudo-merge group tracks the set of non-bitmapped reference tips * A pseudo-merge group tracks the set of non-bitmapped reference tips
@ -72,7 +73,7 @@ struct pseudo_merge_matches {
* entry keys are the pseudo-merge group names, and the values are * entry keys are the pseudo-merge group names, and the values are
* pointers to the pseudo_merge_group structure itself. * pointers to the pseudo_merge_group structure itself.
*/ */
void load_pseudo_merges_from_config(struct string_list *list); void load_pseudo_merges_from_config(struct repository *r, struct string_list *list);


/* /*
* A pseudo-merge commit index (pseudo_merge_commit_idx) maps a * A pseudo-merge commit index (pseudo_merge_commit_idx) maps a
@ -94,8 +95,7 @@ struct pseudo_merge_commit_idx {
* *
* Optionally shows a progress meter. * Optionally shows a progress meter.
*/ */
void select_pseudo_merges(struct bitmap_writer *writer, void select_pseudo_merges(struct bitmap_writer *writer);
struct commit **commits, size_t commits_nr);


/* /*
* Represents a serialized view of a file containing pseudo-merge(s) * Represents a serialized view of a file containing pseudo-merge(s)

View File

@ -742,8 +742,7 @@ static int person_name_atom_parser(struct ref_format *format UNUSED,
return 0; return 0;
} }


static int email_atom_option_parser(struct used_atom *atom, static int email_atom_option_parser(const char **arg)
const char **arg, struct strbuf *err)
{ {
if (!*arg) if (!*arg)
return EO_RAW; return EO_RAW;
@ -761,7 +760,7 @@ static int person_email_atom_parser(struct ref_format *format UNUSED,
const char *arg, struct strbuf *err) const char *arg, struct strbuf *err)
{ {
for (;;) { for (;;) {
int opt = email_atom_option_parser(atom, &arg, err); int opt = email_atom_option_parser(&arg);
const char *bad_arg = arg; const char *bad_arg = arg;


if (opt < 0) if (opt < 0)

View File

@ -1961,9 +1961,8 @@ static int create_ref_symlink(struct ref_lock *lock, const char *target)
return ret; return ret;
} }


static int create_symref_lock(struct files_ref_store *refs, static int create_symref_lock(struct ref_lock *lock, const char *target,
struct ref_lock *lock, const char *refname, struct strbuf *err)
const char *target, struct strbuf *err)
{ {
if (!fdopen_lock_file(&lock->lk, "w")) { if (!fdopen_lock_file(&lock->lk, "w")) {
strbuf_addf(err, "unable to fdopen %s: %s", strbuf_addf(err, "unable to fdopen %s: %s",
@ -2579,8 +2578,7 @@ static int lock_ref_for_update(struct files_ref_store *refs,
} }


if (update->new_target && !(update->flags & REF_LOG_ONLY)) { if (update->new_target && !(update->flags & REF_LOG_ONLY)) {
if (create_symref_lock(refs, lock, update->refname, if (create_symref_lock(lock, update->new_target, err)) {
update->new_target, err)) {
ret = TRANSACTION_GENERIC_ERROR; ret = TRANSACTION_GENERIC_ERROR;
goto out; goto out;
} }