File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,11 @@ The public error API
117117 the last error. This may return NULL if no error has occurred.
118118 Otherwise this should return a `git_error` object indicating the class
119119 of error and the error message that was generated by the library.
120+ Do not use this function unless the prior call to a libgit2 API
121+ returned an error, as it can otherwise give misleading results.
122+ libgit2's error strings are not cleared aggressively,
123+ and this function may return an error string that reflects a prior error,
124+ possibly even reflecting internal state.
120125
121126 The last error is stored in thread-local storage when libgit2 is
122127 compiled with thread support, so you do not have to worry about another
Original file line number Diff line number Diff line change @@ -109,7 +109,12 @@ typedef enum {
109109
110110/**
111111 * Return the last `git_error` object that was generated for the
112- * current thread or NULL if no error has occurred.
112+ * current thread.
113+ *
114+ * The default behaviour of this function is to return NULL if no previous error has occurred.
115+ * However, libgit2's error strings are not cleared aggressively, so a prior
116+ * (unrelated) error may be returned. This can be avoided by only calling
117+ * this function if the prior call to a libgit2 API returned an error.
113118 *
114119 * @return A git_error object.
115120 */
You can’t perform that action at this time.
0 commit comments