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

Function cmd_show_ref__verify

builtin/show-ref.c:167–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167static int cmd_show_ref__verify(const struct show_one_options *show_one_opts,
168 const char **refs)
169{
170 if (!refs || !*refs)
171 die("--verify requires a reference");
172
173 while (*refs) {
174 struct object_id oid;
175
176 if ((starts_with(*refs, "refs/") || refname_is_safe(*refs)) &&
177 !refs_read_ref(get_main_ref_store(the_repository), *refs, &oid)) {
178 struct reference ref = {
179 .name = *refs,
180 .oid = &oid,
181 };
182
183 show_one(show_one_opts, &ref);
184 } else if (!show_one_opts->quiet) {
185 die("'%s' - not a valid ref", *refs);
186 } else {
187 return 1;
188 }
189
190 refs++;
191 }
192
193 return 0;
194}
195
196struct patterns_options {
197 int show_head;

Callers 1

cmd_show_refFunction · 0.85

Calls 6

starts_withFunction · 0.85
refname_is_safeFunction · 0.85
refs_read_refFunction · 0.85
get_main_ref_storeFunction · 0.85
show_oneFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected