* Initialize a repository struct for a submodule based on the provided 'path'. * * Returns the repository struct on success, * NULL when the submodule is not present. */
| 509 | * NULL when the submodule is not present. |
| 510 | */ |
| 511 | static struct repository *open_submodule(const char *path) |
| 512 | { |
| 513 | struct strbuf sb = STRBUF_INIT; |
| 514 | struct repository *out = xmalloc(sizeof(*out)); |
| 515 | |
| 516 | if (submodule_to_gitdir(the_repository, &sb, path) || |
| 517 | repo_init(out, sb.buf, NULL)) { |
| 518 | strbuf_release(&sb); |
| 519 | free(out); |
| 520 | return NULL; |
| 521 | } |
| 522 | |
| 523 | /* Mark it as a submodule */ |
| 524 | out->submodule_prefix = xstrdup(path); |
| 525 | |
| 526 | strbuf_release(&sb); |
| 527 | return out; |
| 528 | } |
| 529 | |
| 530 | /* |
| 531 | * Helper function to display the submodule header line prior to the full |
no test coverage detected