MCPcopy Create free account
hub / github.com/git/git / list_replace_refs

Function list_replace_refs

builtin/replace.c:77–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77static int list_replace_refs(const char *pattern, const char *format)
78{
79 struct show_data data;
80
81 data.repo = the_repository;
82 if (!pattern)
83 pattern = "*";
84 data.pattern = pattern;
85
86 if (format == NULL || *format == '\0' || !strcmp(format, "short"))
87 data.format = REPLACE_FORMAT_SHORT;
88 else if (!strcmp(format, "medium"))
89 data.format = REPLACE_FORMAT_MEDIUM;
90 else if (!strcmp(format, "long"))
91 data.format = REPLACE_FORMAT_LONG;
92 /*
93 * Please update _git_replace() in git-completion.bash when
94 * you add new format
95 */
96 else
97 return error(_("invalid replace format '%s'\n"
98 "valid formats are 'short', 'medium' and 'long'"),
99 format);
100
101 refs_for_each_replace_ref(get_main_ref_store(the_repository),
102 show_reference, (void *)&data);
103
104 return 0;
105}
106
107typedef int (*each_replace_name_fn)(const char *name, const char *ref,
108 const struct object_id *oid);

Callers 1

cmd_replaceFunction · 0.85

Calls 3

errorFunction · 0.85
get_main_ref_storeFunction · 0.85

Tested by

no test coverage detected