Skip to content

Commit 73079d2

Browse files
KarthikNayakgitster
authored andcommitted
for-each-ref: rename variables called sort to sorting
Rename all the variables called sort to sorting to match the function/structure name changes made in the previous patch. Mentored-by: Christian Couder <[email protected]> Mentored-by: Matthieu Moy <[email protected]> Signed-off-by: Karthik Nayak <[email protected]> Reviewed-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 277b915 commit 73079d2

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

builtin/for-each-ref.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -985,9 +985,9 @@ static int compare_refs(const void *a_, const void *b_)
985985
return 0;
986986
}
987987

988-
void ref_array_sort(struct ref_sorting *sort, struct ref_array *array)
988+
void ref_array_sort(struct ref_sorting *sorting, struct ref_array *array)
989989
{
990-
ref_sorting = sort;
990+
ref_sorting = sorting;
991991
qsort(array->items, array->nr, sizeof(struct ref_array_item *), compare_refs);
992992
}
993993

@@ -1089,25 +1089,25 @@ struct ref_sorting *ref_default_sorting(void)
10891089
{
10901090
static const char cstr_name[] = "refname";
10911091

1092-
struct ref_sorting *sort = xcalloc(1, sizeof(*sort));
1092+
struct ref_sorting *sorting = xcalloc(1, sizeof(*sorting));
10931093

1094-
sort->next = NULL;
1095-
sort->atom = parse_ref_filter_atom(cstr_name, cstr_name + strlen(cstr_name));
1096-
return sort;
1094+
sorting->next = NULL;
1095+
sorting->atom = parse_ref_filter_atom(cstr_name, cstr_name + strlen(cstr_name));
1096+
return sorting;
10971097
}
10981098

10991099
int parse_opt_ref_sorting(const struct option *opt, const char *arg, int unset)
11001100
{
1101-
struct ref_sorting **sort_tail = opt->value;
1101+
struct ref_sorting **sorting_tail = opt->value;
11021102
struct ref_sorting *s;
11031103
int len;
11041104

11051105
if (!arg) /* should --no-sort void the list ? */
11061106
return -1;
11071107

11081108
s = xcalloc(1, sizeof(*s));
1109-
s->next = *sort_tail;
1110-
*sort_tail = s;
1109+
s->next = *sorting_tail;
1110+
*sorting_tail = s;
11111111

11121112
if (*arg == '-') {
11131113
s->reverse = 1;
@@ -1127,7 +1127,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
11271127
{
11281128
int i;
11291129
const char *format = "%(objectname) %(objecttype)\t%(refname)";
1130-
struct ref_sorting *sort = NULL, **sort_tail = &sort;
1130+
struct ref_sorting *sorting = NULL, **sorting_tail = &sorting;
11311131
int maxcount = 0, quote_style = 0;
11321132
struct ref_filter_cbdata ref_cbdata;
11331133

@@ -1144,7 +1144,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
11441144
OPT_GROUP(""),
11451145
OPT_INTEGER( 0 , "count", &maxcount, N_("show only <n> matched refs")),
11461146
OPT_STRING( 0 , "format", &format, N_("format"), N_("format to use for the output")),
1147-
OPT_CALLBACK(0 , "sort", sort_tail, N_("key"),
1147+
OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"),
11481148
N_("field name to sort on"), &parse_opt_ref_sorting),
11491149
OPT_END(),
11501150
};
@@ -1161,8 +1161,8 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
11611161
if (verify_ref_format(format))
11621162
usage_with_options(for_each_ref_usage, opts);
11631163

1164-
if (!sort)
1165-
sort = ref_default_sorting();
1164+
if (!sorting)
1165+
sorting = ref_default_sorting();
11661166

11671167
/* for warn_ambiguous_refs */
11681168
git_config(git_default_config, NULL);
@@ -1171,7 +1171,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
11711171
ref_cbdata.filter.name_patterns = argv;
11721172
for_each_rawref(ref_filter_handler, &ref_cbdata);
11731173

1174-
ref_array_sort(sort, &ref_cbdata.array);
1174+
ref_array_sort(sorting, &ref_cbdata.array);
11751175

11761176
if (!maxcount || ref_cbdata.array.nr < maxcount)
11771177
maxcount = ref_cbdata.array.nr;

0 commit comments

Comments
 (0)