Skip to content

Commit 2f1d6ef

Browse files
authored
Merge pull request libgit2#4954 from tiennou/fix/documentation
Documentation fixes
2 parents cf14215 + 690e55e commit 2f1d6ef

File tree

5 files changed

+142
-89
lines changed

5 files changed

+142
-89
lines changed

docs/error-handling.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ int git_repository_open(git_repository **repository, const char *path)
110110
}
111111
~~~
112112
113+
Note that some error codes have been defined with a specific meaning in the
114+
context of callbacks:
115+
- `GIT_EUSER` provides a way to bubble up a non libgit2-related failure, which
116+
allows it to be preserved all the way up to the initial function call (a `git_cred`
117+
setup trying to access an unavailable LDAP server for instance).
118+
- `GIT_EPASSTHROUGH` provides a way to tell libgit2 that it should behave as if
119+
no callback was provided. This is of special interest to bindings, which would
120+
always provide a C function as a "trampoline", and decide at runtime what to do.
121+
113122
The public error API
114123
--------------------
115124
@@ -119,7 +128,7 @@ The public error API
119128
of error and the error message that was generated by the library.
120129
Do not use this function unless the prior call to a libgit2 API
121130
returned an error, as it can otherwise give misleading results.
122-
libgit2's error strings are not cleared aggressively,
131+
libgit2's error strings are not cleared aggressively,
123132
and this function may return an error string that reflects a prior error,
124133
possibly even reflecting internal state.
125134

include/git2/repository.h

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -94,40 +94,53 @@ GIT_EXTERN(int) git_repository_discover(
9494

9595
/**
9696
* Option flags for `git_repository_open_ext`.
97-
*
98-
* * GIT_REPOSITORY_OPEN_NO_SEARCH - Only open the repository if it can be
99-
* immediately found in the start_path. Do not walk up from the
100-
* start_path looking at parent directories.
101-
* * GIT_REPOSITORY_OPEN_CROSS_FS - Unless this flag is set, open will not
102-
* continue searching across filesystem boundaries (i.e. when `st_dev`
103-
* changes from the `stat` system call). (E.g. Searching in a user's home
104-
* directory "/home/user/source/" will not return "/.git/" as the found
105-
* repo if "/" is a different filesystem than "/home".)
106-
* * GIT_REPOSITORY_OPEN_BARE - Open repository as a bare repo regardless
107-
* of core.bare config, and defer loading config file for faster setup.
108-
* Unlike `git_repository_open_bare`, this can follow gitlinks.
109-
* * GIT_REPOSITORY_OPEN_NO_DOTGIT - Do not check for a repository by
110-
* appending /.git to the start_path; only open the repository if
111-
* start_path itself points to the git directory.
112-
* * GIT_REPOSITORY_OPEN_FROM_ENV - Find and open a git repository,
113-
* respecting the environment variables used by the git command-line
114-
* tools. If set, `git_repository_open_ext` will ignore the other
115-
* flags and the `ceiling_dirs` argument, and will allow a NULL `path`
116-
* to use `GIT_DIR` or search from the current directory. The search
117-
* for a repository will respect $GIT_CEILING_DIRECTORIES and
118-
* $GIT_DISCOVERY_ACROSS_FILESYSTEM. The opened repository will
119-
* respect $GIT_INDEX_FILE, $GIT_NAMESPACE, $GIT_OBJECT_DIRECTORY, and
120-
* $GIT_ALTERNATE_OBJECT_DIRECTORIES. In the future, this flag will
121-
* also cause `git_repository_open_ext` to respect $GIT_WORK_TREE and
122-
* $GIT_COMMON_DIR; currently, `git_repository_open_ext` with this
123-
* flag will error out if either $GIT_WORK_TREE or $GIT_COMMON_DIR is
124-
* set.
12597
*/
12698
typedef enum {
99+
/**
100+
* Only open the repository if it can be immediately found in the
101+
* start_path. Do not walk up from the start_path looking at parent
102+
* directories.
103+
*/
127104
GIT_REPOSITORY_OPEN_NO_SEARCH = (1 << 0),
105+
106+
/**
107+
* Unless this flag is set, open will not continue searching across
108+
* filesystem boundaries (i.e. when `st_dev` changes from the `stat`
109+
* system call). For example, searching in a user's home directory at
110+
* "/home/user/source/" will not return "/.git/" as the found repo if
111+
* "/" is a different filesystem than "/home".
112+
*/
128113
GIT_REPOSITORY_OPEN_CROSS_FS = (1 << 1),
114+
115+
/**
116+
* Open repository as a bare repo regardless of core.bare config, and
117+
* defer loading config file for faster setup.
118+
* Unlike `git_repository_open_bare`, this can follow gitlinks.
119+
*/
129120
GIT_REPOSITORY_OPEN_BARE = (1 << 2),
121+
122+
/**
123+
* Do not check for a repository by appending /.git to the start_path;
124+
* only open the repository if start_path itself points to the git
125+
* directory.
126+
*/
130127
GIT_REPOSITORY_OPEN_NO_DOTGIT = (1 << 3),
128+
129+
/**
130+
* Find and open a git repository, respecting the environment variables
131+
* used by the git command-line tools.
132+
* If set, `git_repository_open_ext` will ignore the other flags and
133+
* the `ceiling_dirs` argument, and will allow a NULL `path` to use
134+
* `GIT_DIR` or search from the current directory.
135+
* The search for a repository will respect $GIT_CEILING_DIRECTORIES and
136+
* $GIT_DISCOVERY_ACROSS_FILESYSTEM. The opened repository will
137+
* respect $GIT_INDEX_FILE, $GIT_NAMESPACE, $GIT_OBJECT_DIRECTORY, and
138+
* $GIT_ALTERNATE_OBJECT_DIRECTORIES.
139+
* In the future, this flag will also cause `git_repository_open_ext`
140+
* to respect $GIT_WORK_TREE and $GIT_COMMON_DIR; currently,
141+
* `git_repository_open_ext` with this flag will error out if either
142+
* $GIT_WORK_TREE or $GIT_COMMON_DIR is set.
143+
*/
131144
GIT_REPOSITORY_OPEN_FROM_ENV = (1 << 4),
132145
} git_repository_open_flag_t;
133146

include/git2/signature.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ GIT_BEGIN_DECL
3030
* @param out new signature, in case of error NULL
3131
* @param name name of the person
3232
* @param email email of the person
33-
* @param time time when the action happened
34-
* @param offset timezone offset in minutes for the time
33+
* @param time time (in seconds from epoch) when the action happened
34+
* @param offset timezone offset (in minutes) for the time
3535
* @return 0 or an error code
3636
*/
3737
GIT_EXTERN(int) git_signature_new(git_signature **out, const char *name, const char *email, git_time_t time, int offset);

0 commit comments

Comments
 (0)