Skip to content

Commit

Permalink
add more output parameters to git_repository_discover_ex
Browse files Browse the repository at this point in the history
  • Loading branch information
romkatv committed Feb 15, 2020
1 parent 3f0fedf commit ce5a87c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
5 changes: 4 additions & 1 deletion include/git2/repository.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ GIT_EXTERN(int) git_repository_discover(
const char *ceiling_dirs);

GIT_EXTERN(int) git_repository_discover_ex(
git_buf *out,
git_buf *gitdir_path,
git_buf *workdir_path,
git_buf *gitlink_path,
git_buf *commondir_path,
const char *start_path,
uint32_t flags,
const char *ceiling_dirs);
Expand Down
23 changes: 16 additions & 7 deletions src/repository.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,19 +915,28 @@ int git_repository_discover(
const char *ceiling_dirs)
{
return git_repository_discover_ex(
out, start_path, across_fs ? GIT_REPOSITORY_OPEN_CROSS_FS : 0,
out, NULL, NULL, NULL, start_path,
across_fs ? GIT_REPOSITORY_OPEN_CROSS_FS : 0,
ceiling_dirs);
}

int git_repository_discover_ex(
git_buf *out,
const char *start_path,
uint32_t flags,
const char *ceiling_dirs)
git_buf *gitdir_path,
git_buf *workdir_path,
git_buf *gitlink_path,
git_buf *commondir_path,
const char *start_path,
uint32_t flags,
const char *ceiling_dirs)
{
assert(start_path);
git_buf_sanitize(out);
return find_repo(out, NULL, NULL, NULL, start_path, flags, ceiling_dirs);
if (gitdir_path) git_buf_sanitize(gitdir_path);
if (workdir_path) git_buf_sanitize(workdir_path);
if (gitlink_path) git_buf_sanitize(gitlink_path);
if (commondir_path) git_buf_sanitize(commondir_path);
return find_repo(
gitdir_path, workdir_path, gitlink_path, commondir_path,
start_path, flags, ceiling_dirs);
}

static int load_config(
Expand Down

0 comments on commit ce5a87c

Please sign in to comment.