diff options
| author | Patrick Steinhardt <ps@pks.im> | 2016-11-11 14:36:43 +0100 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2017-02-13 10:28:15 +0100 |
| commit | c5f3da9692f8de15550fed47e377c586f99f7c5a (patch) | |
| tree | 11407a6919e4e94923c003bf8ee7c40ac5bf6642 /src/submodule.c | |
| parent | cb3269c970db6766f8a953fee438b56119fd9847 (diff) | |
| download | libgit2-c5f3da9692f8de15550fed47e377c586f99f7c5a.tar.gz | |
repository: use `git_repository_item_path`
The recent introduction of the commondir variable of a repository
requires callers to distinguish whether their files are part of
the dot-git directory or the common directory shared between
multpile worktrees. In order to take the burden from callers and
unify knowledge on which files reside where, the
`git_repository_item_path` function has been introduced which
encapsulate this knowledge.
Modify most existing callers of `git_repository_path` to use
`git_repository_item_path` instead, thus making them implicitly
aware of the common directory.
Diffstat (limited to 'src/submodule.c')
| -rw-r--r-- | src/submodule.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/submodule.c b/src/submodule.c index 1c17075bf..3007d25df 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -616,8 +616,10 @@ static int submodule_repo_init( * Old style: sub-repo goes directly into repo/<name>/.git/ */ if (use_gitlink) { - error = git_buf_join3( - &repodir, '/', git_repository_path(parent_repo), "modules", path); + error = git_repository_item_path(&repodir, parent_repo, GIT_REPOSITORY_ITEM_MODULES); + if (error < 0) + goto cleanup; + error = git_buf_joinpath(&repodir, repodir.ptr, path); if (error < 0) goto cleanup; @@ -1084,8 +1086,10 @@ static int submodule_repo_create( * <repo-dir>/modules/<name>/ with a gitlink in the * sub-repo workdir directory to that repository. */ - error = git_buf_join3( - &repodir, '/', git_repository_path(parent_repo), "modules", path); + error = git_repository_item_path(&repodir, parent_repo, GIT_REPOSITORY_ITEM_MODULES); + if (error < 0) + goto cleanup; + error = git_buf_joinpath(&repodir, repodir.ptr, path); if (error < 0) goto cleanup; |
