Skip to content

Commit e4f6ab0

Browse files
inosmeetgitster
authored andcommitted
remote: rename function omit_name_by_refspec
Rename the function `omit_name_by_refspec()` to `refname_matches_negative_refspec_item()` to provide clearer intent. The previous function name was vague and did not accurately describe its purpose. By using `refname_matches_negative_refspec_item`, make the function's purpose more intuitive, clarifying that it checks if a reference name matches any negative refspec. Rename function parameters for consistency with existing naming conventions. Use `refname` instead of `name` to align with terminology in `refs.h`. Remove the redundant doc comment since the function name is now self-explanatory. Signed-off-by: Meet Soni <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5f8f708 commit e4f6ab0

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

builtin/remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
383383
states->remote->fetch.items[i].raw);
384384

385385
for (ref = fetch_map; ref; ref = ref->next) {
386-
if (omit_name_by_refspec(ref->name, &states->remote->fetch))
386+
if (refname_matches_negative_refspec_item(ref->name, &states->remote->fetch))
387387
string_list_append(&states->skipped, abbrev_branch(ref->name));
388388
else if (!ref->peer_ref || !refs_ref_exists(get_main_ref_store(the_repository), ref->peer_ref->name))
389389
string_list_append(&states->new_refs, abbrev_branch(ref->name));

remote.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -944,12 +944,12 @@ static int refspec_match(const struct refspec_item *refspec,
944944
return !strcmp(refspec->src, name);
945945
}
946946

947-
int omit_name_by_refspec(const char *name, struct refspec *rs)
947+
int refname_matches_negative_refspec_item(const char *refname, struct refspec *rs)
948948
{
949949
int i;
950950

951951
for (i = 0; i < rs->nr; i++) {
952-
if (rs->items[i].negative && refspec_match(&rs->items[i], name))
952+
if (rs->items[i].negative && refspec_match(&rs->items[i], refname))
953953
return 1;
954954
}
955955
return 0;
@@ -962,7 +962,7 @@ struct ref *apply_negative_refspecs(struct ref *ref_map, struct refspec *rs)
962962
for (tail = &ref_map; *tail; ) {
963963
struct ref *ref = *tail;
964964

965-
if (omit_name_by_refspec(ref->name, rs)) {
965+
if (refname_matches_negative_refspec_item(ref->name, rs)) {
966966
*tail = ref->next;
967967
free(ref->peer_ref);
968968
free(ref);
@@ -1021,7 +1021,7 @@ static int query_matches_negative_refspec(struct refspec *rs, struct refspec_ite
10211021
}
10221022

10231023
for (i = 0; !matched_negative && i < reversed.nr; i++) {
1024-
if (omit_name_by_refspec(reversed.items[i].string, rs))
1024+
if (refname_matches_negative_refspec_item(reversed.items[i].string, rs))
10251025
matched_negative = 1;
10261026
}
10271027

remote.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,7 @@ int resolve_remote_symref(struct ref *ref, struct ref *list);
261261
*/
262262
struct ref *ref_remove_duplicates(struct ref *ref_map);
263263

264-
/*
265-
* Check whether a name matches any negative refspec in rs. Returns 1 if the
266-
* name matches at least one negative refspec, and 0 otherwise.
267-
*/
268-
int omit_name_by_refspec(const char *name, struct refspec *rs);
264+
int refname_matches_negative_refspec_item(const char *refname, struct refspec *rs);
269265

270266
/*
271267
* Remove all entries in the input list which match any negative refspec in

0 commit comments

Comments
 (0)