summaryrefslogtreecommitdiff
path: root/include/git2/repository.h
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2016-04-03 16:01:01 -0700
committerJosh Triplett <josh@joshtriplett.org>2016-06-24 11:44:01 -0700
commit39c6fca33aa38ad26c7c5f36734c6434593daae1 (patch)
treeb6782904f4276033c62dc1b2bb12035c51816153 /include/git2/repository.h
parented577134a5dcf30c95b740859aceebd9c1137157 (diff)
downloadlibgit2-39c6fca33aa38ad26c7c5f36734c6434593daae1.tar.gz
Add GIT_REPOSITORY_OPEN_NO_DOTGIT flag to avoid appending /.git
GIT_REPOSITORY_OPEN_NO_SEARCH does not search up through parent directories, but still tries the specified path both directly and with /.git appended. GIT_REPOSITORY_OPEN_BARE avoids appending /.git, but opens the repository in bare mode even if it has a working directory. To support the semantics git uses when given $GIT_DIR in the environment, provide a new GIT_REPOSITORY_OPEN_NO_DOTGIT flag to not try appending /.git.
Diffstat (limited to 'include/git2/repository.h')
-rw-r--r--include/git2/repository.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h
index 85b7e6861..f7efe0116 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -95,11 +95,15 @@ 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.
*/
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_flag_t;
/**