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

Function read_remotes_file

remote.c:349–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349static void read_remotes_file(struct repository *repo, struct remote *remote)
350{
351 struct strbuf buf = STRBUF_INIT;
352 FILE *f = fopen_or_warn(repo_git_path_append(repo, &buf,
353 "remotes/%s", remote->name), "r");
354
355 if (!f)
356 goto out;
357
358 warn_about_deprecated_remote_type("remotes", remote);
359
360 remote->configured_in_repo = 1;
361 remote->origin = REMOTE_REMOTES;
362 while (strbuf_getline(&buf, f) != EOF) {
363 const char *v;
364
365 strbuf_rtrim(&buf);
366
367 if (skip_prefix(buf.buf, "URL:", &v))
368 add_url_alias(repo->remote_state, remote,
369 skip_spaces(v));
370 else if (skip_prefix(buf.buf, "Push:", &v))
371 refspec_append(&remote->push, skip_spaces(v));
372 else if (skip_prefix(buf.buf, "Pull:", &v))
373 refspec_append(&remote->fetch, skip_spaces(v));
374 }
375 fclose(f);
376
377out:
378 strbuf_release(&buf);
379}
380
381static void read_branches_file(struct repository *repo, struct remote *remote)
382{

Callers 1

remotes_remote_get_1Function · 0.85

Calls 9

fopen_or_warnFunction · 0.85
repo_git_path_appendFunction · 0.85
strbuf_getlineFunction · 0.85
strbuf_rtrimFunction · 0.85
add_url_aliasFunction · 0.85
skip_spacesFunction · 0.85
refspec_appendFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected