| 347 | } |
| 348 | |
| 349 | static 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 | |
| 377 | out: |
| 378 | strbuf_release(&buf); |
| 379 | } |
| 380 | |
| 381 | static void read_branches_file(struct repository *repo, struct remote *remote) |
| 382 | { |
no test coverage detected