Returns 0 on success, negative on failure. */
| 558 | |
| 559 | /* Returns 0 on success, negative on failure. */ |
| 560 | static int do_submodule_path(struct repository *repo, |
| 561 | struct strbuf *buf, const char *path, |
| 562 | const char *fmt, va_list args) |
| 563 | { |
| 564 | struct strbuf git_submodule_common_dir = STRBUF_INIT; |
| 565 | struct strbuf git_submodule_dir = STRBUF_INIT; |
| 566 | int ret; |
| 567 | |
| 568 | ret = submodule_to_gitdir(repo, &git_submodule_dir, path); |
| 569 | if (ret) |
| 570 | goto cleanup; |
| 571 | |
| 572 | strbuf_complete(&git_submodule_dir, '/'); |
| 573 | strbuf_addbuf(buf, &git_submodule_dir); |
| 574 | strbuf_vaddf(buf, fmt, args); |
| 575 | |
| 576 | if (get_common_dir_noenv(&git_submodule_common_dir, git_submodule_dir.buf)) |
| 577 | update_common_dir(buf, git_submodule_dir.len, git_submodule_common_dir.buf); |
| 578 | |
| 579 | strbuf_cleanup_path(buf); |
| 580 | |
| 581 | cleanup: |
| 582 | strbuf_release(&git_submodule_dir); |
| 583 | strbuf_release(&git_submodule_common_dir); |
| 584 | return ret; |
| 585 | } |
| 586 | |
| 587 | char *repo_submodule_path(struct repository *repo, |
| 588 | const char *path, const char *fmt, ...) |
no test coverage detected