diff options
| author | Edward Thomson <ethomson@github.com> | 2016-07-01 18:45:10 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-01 18:45:10 -0400 |
| commit | ebeb56f0f53803e5c11429b01618e0182ad59fca (patch) | |
| tree | ae6d5f6a4f9b3d7beb6c965910cd46ae617db3f4 /include/git2 | |
| parent | e4218450338cf6757077f63bac570ea77f655eff (diff) | |
| parent | 2b80260ea580a454495cb0cb87c9f1b38a5cc10b (diff) | |
| download | libgit2-ebeb56f0f53803e5c11429b01618e0182ad59fca.tar.gz | |
Merge pull request #3711 from joshtriplett/git_repository_discover_default
Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/repository.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h index 85b7e6861..3d70d1b89 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -95,11 +95,29 @@ GIT_EXTERN(int) git_repository_discover( * * GIT_REPOSITORY_OPEN_BARE - Open repository as a bare repo regardless * of core.bare config, and defer loading config file for faster setup. * Unlike `git_repository_open_bare`, this can follow gitlinks. + * * GIT_REPOSITORY_OPEN_NO_DOTGIT - Do not check for a repository by + * appending /.git to the start_path; only open the repository if + * start_path itself points to the git directory. + * * GIT_REPOSITORY_OPEN_FROM_ENV - Find and open a git repository, + * respecting the environment variables used by the git command-line + * tools. If set, `git_repository_open_ext` will ignore the other + * flags and the `ceiling_dirs` argument, and will allow a NULL `path` + * to use `GIT_DIR` or search from the current directory. The search + * for a repository will respect $GIT_CEILING_DIRECTORIES and + * $GIT_DISCOVERY_ACROSS_FILESYSTEM. The opened repository will + * respect $GIT_INDEX_FILE, $GIT_NAMESPACE, $GIT_OBJECT_DIRECTORY, and + * $GIT_ALTERNATE_OBJECT_DIRECTORIES. In the future, this flag will + * also cause `git_repository_open_ext` to respect $GIT_WORK_TREE and + * $GIT_COMMON_DIR; currently, `git_repository_open_ext` with this + * flag will error out if either $GIT_WORK_TREE or $GIT_COMMON_DIR is + * set. */ typedef enum { GIT_REPOSITORY_OPEN_NO_SEARCH = (1 << 0), GIT_REPOSITORY_OPEN_CROSS_FS = (1 << 1), GIT_REPOSITORY_OPEN_BARE = (1 << 2), + GIT_REPOSITORY_OPEN_NO_DOTGIT = (1 << 3), + GIT_REPOSITORY_OPEN_FROM_ENV = (1 << 4), } git_repository_open_flag_t; /** @@ -110,7 +128,8 @@ typedef enum { * see if a repo at this path could be opened. * @param path Path to open as git repository. If the flags * permit "searching", then this can be a path to a subdirectory - * inside the working directory of the repository. + * inside the working directory of the repository. May be NULL if + * flags is GIT_REPOSITORY_OPEN_FROM_ENV. * @param flags A combination of the GIT_REPOSITORY_OPEN flags above. * @param ceiling_dirs A GIT_PATH_LIST_SEPARATOR delimited list of path * prefixes at which the search for a containing repository should |
