Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
libgit2/include/git2/errors.h at development · scm-tools/libgit2 · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
scm-tools
libgit2
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
development
Breadcrumbs
libgit2
/
include
/
git2
/
errors.h
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
117 lines (106 loc) · 3.03 KB
development
Breadcrumbs
libgit2
/
include
/
git2
/
errors.h
Copy path
Top
File metadata and controls
Code
Blame
117 lines (106 loc) · 3.03 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Copyright (C) 2009-2012 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef
INCLUDE_git_errors_h__
#define
INCLUDE_git_errors_h__
#include
"common.h"
/**
* @file git2/errors.h
* @brief Git error handling routines and variables
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL
/** Generic return codes */
enum
{
GIT_OK
=
0
,
GIT_ERROR
=
-1
,
GIT_ENOTFOUND
=
-3
,
GIT_EEXISTS
=
-4
,
GIT_EAMBIGUOUS
=
-5
,
GIT_EBUFS
=
-6
,
GIT_EUSER
=
-7
,
GIT_EBAREREPO
=
-8
,
GIT_EORPHANEDHEAD
=
-9
,
GIT_EUNMERGED
=
-10
,
GIT_ENONFASTFORWARD
=
-11
,
GIT_EINVALIDSPEC
=
-12
,
GIT_PASSTHROUGH
=
-30
,
GIT_ITEROVER
=
-31
,
};
typedef
struct
{
char
*
message
;
int
klass
;
}
git_error
;
/** Error classes */
typedef
enum
{
GITERR_NOMEMORY
,
GITERR_OS
,
GITERR_INVALID
,
GITERR_REFERENCE
,
GITERR_ZLIB
,
GITERR_REPOSITORY
,
GITERR_CONFIG
,
GITERR_REGEX
,
GITERR_ODB
,
GITERR_INDEX
,
GITERR_OBJECT
,
GITERR_NET
,
GITERR_TAG
,
GITERR_TREE
,
GITERR_INDEXER
,
GITERR_SSL
,
GITERR_SUBMODULE
,
GITERR_THREAD
,
GITERR_STASH
,
GITERR_CHECKOUT
,
}
git_error_t
;
/**
* Return the last `git_error` object that was generated for the
* current thread or NULL if no error has occurred.
*
* @return A git_error object.
*/
GIT_EXTERN
(
const
git_error
*
)
giterr_last
(
void
);
/**
* Clear the last library error that occurred for this thread.
*/
GIT_EXTERN
(
void
)
giterr_clear
(
void
);
/**
* Set the error message string for this thread.
*
* This function is public so that custom ODB backends and the like can
* relay an error message through libgit2. Most regular users of libgit2
* will never need to call this function -- actually, calling it in most
* circumstances (for example, calling from within a callback function)
* will just end up having the value overwritten by libgit2 internals.
*
* This error message is stored in thread-local storage and only applies
* to the particular thread that this libgit2 call is made from.
*
* NOTE: Passing the `error_class` as GITERR_OS has a special behavior: we
* attempt to append the system default error message for the last OS error
* that occurred and then clear the last error. The specific implementation
* of looking up and clearing this last OS error will vary by platform.
*
* @param error_class One of the `git_error_t` enum above describing the
* general subsystem that is responsible for the error.
* @param message The formatted error message to keep
*/
GIT_EXTERN
(
void
)
giterr_set_str
(
int
error_class
,
const
char
*
string
);
/**
* Set the error message to a special value for memory allocation failure.
*
* The normal `giterr_set_str()` function attempts to `strdup()` the string
* that is passed in. This is not a good idea when the error in question
* is a memory allocation failure. That circumstance has a special setter
* function that sets the error string to a known and statically allocated
* internal value.
*/
GIT_EXTERN
(
void
)
giterr_set_oom
(
void
);
/** @} */
GIT_END_DECL
#endif
You can’t perform that action at this time.