Blame


1 7b19e0f1 2017-11-05 stsp /*
2 5aa81393 2020-01-06 stsp * Copyright (c) 2018, 2019, 2020 Stefan Sperling <stsp@openbsd.org>
3 93658fb9 2020-03-18 stsp * Copyright (c) 2020 Ori Bernstein <ori@openbsd.org>
4 7b19e0f1 2017-11-05 stsp *
5 7b19e0f1 2017-11-05 stsp * Permission to use, copy, modify, and distribute this software for any
6 7b19e0f1 2017-11-05 stsp * purpose with or without fee is hereby granted, provided that the above
7 7b19e0f1 2017-11-05 stsp * copyright notice and this permission notice appear in all copies.
8 7b19e0f1 2017-11-05 stsp *
9 7b19e0f1 2017-11-05 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 7b19e0f1 2017-11-05 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 7b19e0f1 2017-11-05 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 7b19e0f1 2017-11-05 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 7b19e0f1 2017-11-05 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 7b19e0f1 2017-11-05 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 7b19e0f1 2017-11-05 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 7b19e0f1 2017-11-05 stsp */
17 4027f31a 2017-11-04 stsp
18 4027f31a 2017-11-04 stsp /* Error codes */
19 0a585a0d 2018-03-17 stsp #define GOT_ERR_OK 0
20 0a585a0d 2018-03-17 stsp #define GOT_ERR_ERRNO 1
21 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NOT_GIT_REPO 2
22 61a7d79f 2020-02-29 stsp /* 3 is currently unused */
23 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_PATH 4
24 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NOT_REF 5
25 a1fd68d8 2018-01-12 stsp #define GOT_ERR_IO 6
26 a1fd68d8 2018-01-12 stsp #define GOT_ERR_EOF 7
27 a1fd68d8 2018-01-12 stsp #define GOT_ERR_DECOMPRESSION 8
28 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NO_SPACE 9
29 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_OBJ_HDR 10
30 a1fd68d8 2018-01-12 stsp #define GOT_ERR_OBJ_TYPE 11
31 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_OBJ_DATA 12
32 e09a504c 2019-06-28 stsp #define GOT_ERR_AMBIGUOUS_ID 13
33 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_PACKIDX 14
34 a1fd68d8 2018-01-12 stsp #define GOT_ERR_PACKIDX_CSUM 15
35 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_PACKFILE 16
36 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NO_OBJ 17
37 a487c1d0 2018-01-14 stsp #define GOT_ERR_NOT_IMPL 18
38 3ee5fc21 2018-01-17 stsp #define GOT_ERR_OBJ_NOT_PACKED 19
39 96f5e8b3 2018-01-23 stsp #define GOT_ERR_BAD_DELTA_CHAIN 20
40 885d3e02 2018-01-27 stsp #define GOT_ERR_BAD_DELTA 21
41 885d3e02 2018-01-27 stsp #define GOT_ERR_COMPRESSION 22
42 59ece79d 2018-02-12 stsp #define GOT_ERR_BAD_OBJ_ID_STR 23
43 86c3caaf 2018-03-09 stsp #define GOT_ERR_WORKTREE_EXISTS 26
44 09fe317a 2018-03-11 stsp #define GOT_ERR_WORKTREE_META 27
45 6d9d28c3 2018-03-11 stsp #define GOT_ERR_WORKTREE_VERS 28
46 6d9d28c3 2018-03-11 stsp #define GOT_ERR_WORKTREE_BUSY 29
47 9d31a1d8 2018-03-11 stsp #define GOT_ERR_DIR_OBSTRUCTED 30
48 9d31a1d8 2018-03-11 stsp #define GOT_ERR_FILE_OBSTRUCTED 31
49 5b7e13a7 2018-04-02 stsp #define GOT_ERR_RECURSION 32
50 2178c42e 2018-04-22 stsp #define GOT_ERR_TIMEOUT 33
51 2178c42e 2018-04-22 stsp #define GOT_ERR_INTERRUPT 34
52 2178c42e 2018-04-22 stsp #define GOT_ERR_PRIVSEP_READ 35
53 2178c42e 2018-04-22 stsp #define GOT_ERR_PRIVSEP_LEN 36
54 2178c42e 2018-04-22 stsp #define GOT_ERR_PRIVSEP_PIPE 37
55 2178c42e 2018-04-22 stsp #define GOT_ERR_PRIVSEP_NO_FD 38
56 8c580685 2018-04-22 stsp #define GOT_ERR_PRIVSEP_MSG 39
57 b419fc47 2018-04-26 stsp #define GOT_ERR_PRIVSEP_DIED 40
58 b419fc47 2018-04-26 stsp #define GOT_ERR_PRIVSEP_EXIT 41
59 0c048b15 2018-04-27 stsp #define GOT_ERR_PACK_OFFSET 42
60 54be8251 2018-06-04 stsp #define GOT_ERR_OBJ_EXISTS 43
61 54be8251 2018-06-04 stsp #define GOT_ERR_BAD_OBJ_ID 44
62 3d509237 2020-01-04 stsp #define GOT_ERR_ITER_BUSY 45
63 9ba79e04 2018-06-11 stsp #define GOT_ERR_ITER_COMPLETED 46
64 730c718b 2018-06-21 stsp #define GOT_ERR_RANGE 47
65 89817b30 2018-11-11 stsp #define GOT_ERR_EXPECTED 48 /* for use in regress tests only */
66 99437157 2018-11-11 stsp #define GOT_ERR_CANCELLED 49
67 d1451975 2018-11-11 stsp #define GOT_ERR_NO_TREE_ENTRY 50
68 52a74475 2018-12-24 stsp #define GOT_ERR_FILEIDX_SIG 51
69 52a74475 2018-12-24 stsp #define GOT_ERR_FILEIDX_VER 52
70 52a74475 2018-12-24 stsp #define GOT_ERR_FILEIDX_CSUM 53
71 49520a32 2018-12-29 stsp #define GOT_ERR_PATH_PREFIX 54
72 be7061eb 2018-12-30 stsp #define GOT_ERR_ANCESTRY 55
73 27793341 2019-01-12 stsp #define GOT_ERR_FILEIDX_BAD 56
74 a808cfa5 2019-02-03 stsp #define GOT_ERR_BAD_REF_DATA 57
75 f5d3d7af 2019-02-05 stsp #define GOT_ERR_TREE_DUP_ENTRY 58
76 f5d3d7af 2019-02-05 stsp #define GOT_ERR_DIR_DUP_ENTRY 59
77 247140b2 2019-02-05 stsp #define GOT_ERR_NOT_WORKTREE 60
78 09589288 2019-03-10 stsp #define GOT_ERR_UUID_VERSION 61
79 09589288 2019-03-10 stsp #define GOT_ERR_UUID_INVALID 62
80 09589288 2019-03-10 stsp #define GOT_ERR_UUID 63
81 01b7ba6b 2019-03-11 stsp #define GOT_ERR_LOCKFILE_TIMEOUT 64
82 f77a24b0 2019-03-11 stsp #define GOT_ERR_BAD_REF_NAME 65
83 0c48fee2 2019-03-11 stsp #define GOT_ERR_WORKTREE_REPO 66
84 2ec1f75b 2019-03-26 stsp #define GOT_ERR_FILE_MODIFIED 67
85 2ec1f75b 2019-03-26 stsp #define GOT_ERR_FILE_STATUS 68
86 c4296144 2019-05-09 stsp #define GOT_ERR_COMMIT_CONFLICT 69
87 b249b824 2019-05-09 stsp #define GOT_ERR_BAD_REF_TYPE 70
88 35bd8fed 2019-05-09 stsp #define GOT_ERR_COMMIT_NO_AUTHOR 71
89 09f5bd90 2019-05-09 stsp #define GOT_ERR_COMMIT_HEAD_CHANGED 72
90 819f385b 2019-05-10 stsp #define GOT_ERR_COMMIT_OUT_OF_DATE 73
91 33ad4cbe 2019-05-12 jcs #define GOT_ERR_COMMIT_MSG_EMPTY 74
92 33ad4cbe 2019-05-12 jcs #define GOT_ERR_DIR_NOT_EMPTY 75
93 33ad4cbe 2019-05-12 jcs #define GOT_ERR_COMMIT_NO_CHANGES 76
94 a367ff0f 2019-05-14 stsp #define GOT_ERR_BRANCH_MOVED 77
95 79c99a64 2019-05-23 stsp #define GOT_ERR_OBJ_TOO_LARGE 78
96 234035bc 2019-06-01 stsp #define GOT_ERR_SAME_BRANCH 79
97 5ef14e63 2019-06-02 stsp #define GOT_ERR_ROOT_COMMIT 80
98 234035bc 2019-06-01 stsp #define GOT_ERR_MIXED_COMMITS 81
99 234035bc 2019-06-01 stsp #define GOT_ERR_CONFLICTS 82
100 4e759de4 2019-06-26 stsp #define GOT_ERR_BRANCH_EXISTS 83
101 818c7501 2019-07-11 stsp #define GOT_ERR_MODIFIED 84
102 818c7501 2019-07-11 stsp #define GOT_ERR_NOT_REBASING 85
103 818c7501 2019-07-11 stsp #define GOT_ERR_EMPTY_REBASE 86
104 818c7501 2019-07-11 stsp #define GOT_ERR_REBASE_COMMITID 87
105 7d5807f4 2019-07-11 stsp #define GOT_ERR_REBASING 88
106 64c6d990 2019-07-11 stsp #define GOT_ERR_REBASE_PATH 89
107 0ebf8283 2019-07-24 stsp #define GOT_ERR_NOT_HISTEDIT 90
108 0ebf8283 2019-07-24 stsp #define GOT_ERR_EMPTY_HISTEDIT 91
109 0ebf8283 2019-07-24 stsp #define GOT_ERR_NO_HISTEDIT_CMD 92
110 0ebf8283 2019-07-24 stsp #define GOT_ERR_HISTEDIT_SYNTAX 93
111 0ebf8283 2019-07-24 stsp #define GOT_ERR_HISTEDIT_CANCEL 94
112 de05890f 2020-03-05 stsp /* 95 is currently unused */
113 0ebf8283 2019-07-24 stsp #define GOT_ERR_HISTEDIT_BUSY 96
114 0ebf8283 2019-07-24 stsp #define GOT_ERR_HISTEDIT_CMD 97
115 8ca9bd68 2019-07-25 stsp #define GOT_ERR_HISTEDIT_PATH 98
116 8f8646e5 2019-07-25 stsp #define GOT_ERR_NO_MERGED_PATHS 99
117 916f288c 2019-07-30 stsp #define GOT_ERR_COMMIT_BRANCH 100
118 9acbc4fa 2019-08-03 stsp #define GOT_ERR_FILE_STAGED 101
119 d3e7c587 2019-08-03 stsp #define GOT_ERR_STAGE_NO_CHANGE 102
120 ebf48fd5 2019-08-03 stsp #define GOT_ERR_STAGE_CONFLICT 103
121 735ef5ac 2019-08-03 stsp #define GOT_ERR_STAGE_OUT_OF_DATE 104
122 f0b75401 2019-08-03 stsp #define GOT_ERR_FILE_NOT_STAGED 105
123 f032f1f7 2019-08-04 stsp #define GOT_ERR_STAGED_PATHS 106
124 dc424a06 2019-08-07 stsp #define GOT_ERR_PATCH_CHOICE 107
125 84792843 2019-08-09 stsp #define GOT_ERR_COMMIT_NO_EMAIL 108
126 8e7bd50a 2019-08-22 stsp #define GOT_ERR_TAG_EXISTS 109
127 aba9c984 2019-09-08 stsp #define GOT_ERR_GIT_REPO_FORMAT 110
128 2822a352 2019-10-15 stsp #define GOT_ERR_REBASE_REQUIRED 111
129 6d17833f 2019-11-08 stsp #define GOT_ERR_REGEX 112
130 bd5895f3 2019-11-28 stsp #define GOT_ERR_REF_NAME_MINUS 113
131 cd95becd 2019-11-29 stsp #define GOT_ERR_GITCONFIG_SYNTAX 114
132 abd4a1be 2020-03-18 stsp #define GOT_ERR_REBASE_OUT_OF_DATE 115
133 abd4a1be 2020-03-18 stsp #define GOT_ERR_CACHE_DUP_ENTRY 116
134 abd4a1be 2020-03-18 stsp #define GOT_ERR_QUERYSTRING 117
135 abd4a1be 2020-03-18 stsp #define GOT_ERR_FETCH_FAILED 118
136 abd4a1be 2020-03-18 stsp #define GOT_ERR_PARSE_URI 119
137 abd4a1be 2020-03-18 stsp #define GOT_ERR_BAD_PROTO 120
138 5cc27ede 2020-03-18 stsp #define GOT_ERR_ADDRINFO 121
139 fe53745c 2020-03-18 stsp #define GOT_ERR_BAD_PACKET 122
140 7848a0e1 2020-03-19 stsp #define GOT_ERR_NO_REMOTE 123
141 4027f31a 2017-11-04 stsp
142 4027f31a 2017-11-04 stsp static const struct got_error {
143 4027f31a 2017-11-04 stsp int code;
144 4027f31a 2017-11-04 stsp const char *msg;
145 4027f31a 2017-11-04 stsp } got_errors[] = {
146 0a585a0d 2018-03-17 stsp { GOT_ERR_OK, "no error occured?!?" },
147 f334529e 2018-01-12 stsp { GOT_ERR_ERRNO, "see errno" },
148 4027f31a 2017-11-04 stsp { GOT_ERR_NOT_GIT_REPO, "no git repository found" },
149 61a7d79f 2020-02-29 stsp { 3, "unused error code" },
150 4027f31a 2017-11-04 stsp { GOT_ERR_BAD_PATH, "bad path" },
151 4027f31a 2017-11-04 stsp { GOT_ERR_NOT_REF, "no such reference found" },
152 ab9a70b2 2017-11-06 stsp { GOT_ERR_IO, "input/output error" },
153 ab9a70b2 2017-11-06 stsp { GOT_ERR_EOF, "unexpected end of file" },
154 ab9a70b2 2017-11-06 stsp { GOT_ERR_DECOMPRESSION,"decompression failed" },
155 ab9a70b2 2017-11-06 stsp { GOT_ERR_NO_SPACE, "buffer too small" },
156 ab9a70b2 2017-11-06 stsp { GOT_ERR_BAD_OBJ_HDR, "bad object header" },
157 d1cda826 2017-11-06 stsp { GOT_ERR_OBJ_TYPE, "wrong type of object" },
158 d1cda826 2017-11-06 stsp { GOT_ERR_BAD_OBJ_DATA, "bad object data" },
159 e09a504c 2019-06-28 stsp { GOT_ERR_AMBIGUOUS_ID, "ambiguous object ID" },
160 0a0a3048 2018-01-10 stsp { GOT_ERR_BAD_PACKIDX, "bad pack index file" },
161 0ebaf008 2018-01-10 stsp { GOT_ERR_PACKIDX_CSUM, "pack index file checksum error" },
162 a1fd68d8 2018-01-12 stsp { GOT_ERR_BAD_PACKFILE, "bad pack file" },
163 a1fd68d8 2018-01-12 stsp { GOT_ERR_NO_OBJ, "object not found" },
164 a487c1d0 2018-01-14 stsp { GOT_ERR_NOT_IMPL, "feature not implemented" },
165 3ee5fc21 2018-01-17 stsp { GOT_ERR_OBJ_NOT_PACKED,"object is not packed" },
166 96f5e8b3 2018-01-23 stsp { GOT_ERR_BAD_DELTA_CHAIN,"bad delta chain" },
167 59ece79d 2018-02-12 stsp { GOT_ERR_BAD_DELTA, "bad delta" },
168 59ece79d 2018-02-12 stsp { GOT_ERR_COMPRESSION, "compression failed" },
169 59ece79d 2018-02-12 stsp { GOT_ERR_BAD_OBJ_ID_STR,"bad object id string" },
170 86c3caaf 2018-03-09 stsp { GOT_ERR_WORKTREE_EXISTS,"worktree already exists" },
171 09fe317a 2018-03-11 stsp { GOT_ERR_WORKTREE_META,"bad worktree meta data" },
172 6d9d28c3 2018-03-11 stsp { GOT_ERR_WORKTREE_VERS,"unsupported worktree format version" },
173 6d9d28c3 2018-03-11 stsp { GOT_ERR_WORKTREE_BUSY,"worktree already locked" },
174 95edb37e 2019-03-28 stsp { GOT_ERR_FILE_OBSTRUCTED,"file is obstructed" },
175 5b7e13a7 2018-04-02 stsp { GOT_ERR_RECURSION, "recursion limit reached" },
176 2178c42e 2018-04-22 stsp { GOT_ERR_TIMEOUT, "operation timed out" },
177 2178c42e 2018-04-22 stsp { GOT_ERR_INTERRUPT, "operation interrupted" },
178 55afbf19 2018-09-08 stsp { GOT_ERR_PRIVSEP_READ, "no data received in imsg" },
179 55afbf19 2018-09-08 stsp { GOT_ERR_PRIVSEP_LEN, "unexpected amount of data received in imsg" },
180 55afbf19 2018-09-08 stsp { GOT_ERR_PRIVSEP_PIPE, "privsep peer process closed pipe" },
181 55afbf19 2018-09-08 stsp { GOT_ERR_PRIVSEP_NO_FD,"privsep file descriptor unavailable" },
182 4c838a52 2018-12-23 stsp { GOT_ERR_PRIVSEP_MSG, "received unexpected privsep message" },
183 54be8251 2018-06-04 stsp { GOT_ERR_PRIVSEP_DIED, "unprivileged process died unexpectedly" },
184 54be8251 2018-06-04 stsp { GOT_ERR_PRIVSEP_EXIT, "bad exit code from unprivileged process" },
185 54be8251 2018-06-04 stsp { GOT_ERR_PACK_OFFSET, "bad offset in pack file" },
186 54be8251 2018-06-04 stsp { GOT_ERR_OBJ_EXISTS, "object already exists" },
187 54be8251 2018-06-04 stsp { GOT_ERR_BAD_OBJ_ID, "bad object id" },
188 3d509237 2020-01-04 stsp { GOT_ERR_ITER_BUSY, "iteration already in progress" },
189 9ba79e04 2018-06-11 stsp { GOT_ERR_ITER_COMPLETED,"iteration completed" },
190 730c718b 2018-06-21 stsp { GOT_ERR_RANGE, "value out of range" },
191 89817b30 2018-11-11 stsp { GOT_ERR_EXPECTED, "expected an error but have no error" },
192 99437157 2018-11-11 stsp { GOT_ERR_CANCELLED, "operation in progress has been cancelled" },
193 d1451975 2018-11-11 stsp { GOT_ERR_NO_TREE_ENTRY,"no such entry found in tree" },
194 52a74475 2018-12-24 stsp { GOT_ERR_FILEIDX_SIG, "bad file index signature" },
195 52a74475 2018-12-24 stsp { GOT_ERR_FILEIDX_VER, "unknown file index format version" },
196 52a74475 2018-12-24 stsp { GOT_ERR_FILEIDX_CSUM, "bad file index checksum" },
197 49520a32 2018-12-29 stsp { GOT_ERR_PATH_PREFIX, "worktree already contains items from a "
198 49520a32 2018-12-29 stsp "different path prefix" },
199 a367ff0f 2019-05-14 stsp { GOT_ERR_ANCESTRY, "target commit is on a different branch" },
200 27793341 2019-01-12 stsp { GOT_ERR_FILEIDX_BAD, "file index is corrupt" },
201 a808cfa5 2019-02-03 stsp { GOT_ERR_BAD_REF_DATA, "could not parse reference data" },
202 f5d3d7af 2019-02-05 stsp { GOT_ERR_TREE_DUP_ENTRY,"duplicate entry in tree object" },
203 f5d3d7af 2019-02-05 stsp { GOT_ERR_DIR_DUP_ENTRY,"duplicate entry in directory" },
204 247140b2 2019-02-05 stsp { GOT_ERR_NOT_WORKTREE, "no got work tree found" },
205 09589288 2019-03-10 stsp { GOT_ERR_UUID_VERSION, "bad uuid version" },
206 09589288 2019-03-10 stsp { GOT_ERR_UUID_INVALID, "uuid invalid" },
207 09589288 2019-03-10 stsp { GOT_ERR_UUID, "uuid error" },
208 01b7ba6b 2019-03-11 stsp { GOT_ERR_LOCKFILE_TIMEOUT,"lockfile timeout" },
209 f77a24b0 2019-03-11 stsp { GOT_ERR_BAD_REF_NAME, "bad reference name" },
210 0c48fee2 2019-03-11 stsp { GOT_ERR_WORKTREE_REPO,"cannot create worktree inside a git repository" },
211 2ec1f75b 2019-03-26 stsp { GOT_ERR_FILE_MODIFIED,"file contains modifications" },
212 2ec1f75b 2019-03-26 stsp { GOT_ERR_FILE_STATUS, "file has unexpected status" },
213 c4296144 2019-05-09 stsp { GOT_ERR_COMMIT_CONFLICT,"cannot commit file in conflicted status" },
214 b249b824 2019-05-09 stsp { GOT_ERR_BAD_REF_TYPE, "bad reference type" },
215 35bd8fed 2019-05-09 stsp { GOT_ERR_COMMIT_NO_AUTHOR,"GOT_AUTHOR environment variable is not set" },
216 09f5bd90 2019-05-09 stsp { GOT_ERR_COMMIT_HEAD_CHANGED, "branch head in repository has changed "
217 09f5bd90 2019-05-09 stsp "while commit was in progress" },
218 819f385b 2019-05-10 stsp { GOT_ERR_COMMIT_OUT_OF_DATE, "work tree must be updated before these "
219 819f385b 2019-05-10 stsp "changes can be committed" },
220 33ad4cbe 2019-05-12 jcs { GOT_ERR_COMMIT_MSG_EMPTY, "commit message cannot be empty" },
221 196d54c7 2019-05-15 stsp { GOT_ERR_DIR_NOT_EMPTY, "directory exists and is not empty" },
222 33ad4cbe 2019-05-12 jcs { GOT_ERR_COMMIT_NO_CHANGES, "no changes to commit" },
223 a1fb16d8 2019-05-24 stsp { GOT_ERR_BRANCH_MOVED, "work tree's head reference now points to a "
224 a1fb16d8 2019-05-24 stsp "different branch; new head reference and/or update -b required" },
225 79c99a64 2019-05-23 stsp { GOT_ERR_OBJ_TOO_LARGE, "object too large" },
226 234035bc 2019-06-01 stsp { GOT_ERR_SAME_BRANCH, "commit is already contained in this branch" },
227 5ef14e63 2019-06-02 stsp { GOT_ERR_ROOT_COMMIT, "specified commit has no parent commit" },
228 234035bc 2019-06-01 stsp { GOT_ERR_MIXED_COMMITS,"work tree contains files from multiple "
229 234035bc 2019-06-01 stsp "base commits; the entire work tree must be updated first" },
230 234035bc 2019-06-01 stsp { GOT_ERR_CONFLICTS, "work tree contains conflicted files; these "
231 234035bc 2019-06-01 stsp "conflicts must be resolved first" },
232 4e759de4 2019-06-26 stsp { GOT_ERR_BRANCH_EXISTS,"specified branch already exists" },
233 818c7501 2019-07-11 stsp { GOT_ERR_MODIFIED, "work tree contains local changes; these "
234 818c7501 2019-07-11 stsp "changes must be committed or reverted first" },
235 818c7501 2019-07-11 stsp { GOT_ERR_NOT_REBASING, "rebase operation not in progress" },
236 818c7501 2019-07-11 stsp { GOT_ERR_EMPTY_REBASE, "no commits to rebase" },
237 818c7501 2019-07-11 stsp { GOT_ERR_REBASE_COMMITID,"rebase commit ID mismatch" },
238 7d5807f4 2019-07-11 stsp { GOT_ERR_REBASING, "a rebase operation is in progress in this "
239 7d5807f4 2019-07-11 stsp "work tree and must be continued or aborted first" },
240 64c6d990 2019-07-11 stsp { GOT_ERR_REBASE_PATH, "cannot rebase branch which contains "
241 64c6d990 2019-07-11 stsp "changes outside of this work tree's path prefix" },
242 0ebf8283 2019-07-24 stsp { GOT_ERR_NOT_HISTEDIT, "histedit operation not in progress" },
243 ff6aa206 2019-07-25 stsp { GOT_ERR_EMPTY_HISTEDIT,"no commits to edit; perhaps the work tree "
244 ff6aa206 2019-07-25 stsp "must be updated to an older commit first" },
245 0ebf8283 2019-07-24 stsp { GOT_ERR_NO_HISTEDIT_CMD,"no histedit commands provided" },
246 0ebf8283 2019-07-24 stsp { GOT_ERR_HISTEDIT_SYNTAX,"syntax error in histedit command list" },
247 0ebf8283 2019-07-24 stsp { GOT_ERR_HISTEDIT_CANCEL,"histedit operation cancelled" },
248 de05890f 2020-03-05 stsp { 95, "unused error code" },
249 0ebf8283 2019-07-24 stsp { GOT_ERR_HISTEDIT_BUSY,"histedit operation is in progress in this "
250 0ebf8283 2019-07-24 stsp "work tree and must be continued or aborted first" },
251 0ebf8283 2019-07-24 stsp { GOT_ERR_HISTEDIT_CMD, "bad histedit command" },
252 8ca9bd68 2019-07-25 stsp { GOT_ERR_HISTEDIT_PATH, "cannot edit branch history which contains "
253 8ca9bd68 2019-07-25 stsp "changes outside of this work tree's path prefix" },
254 8f8646e5 2019-07-25 stsp { GOT_ERR_NO_MERGED_PATHS, "empty list of merged paths" },
255 916f288c 2019-07-30 stsp { GOT_ERR_COMMIT_BRANCH, "will not commit to a branch outside the "
256 916f288c 2019-07-30 stsp "\"refs/heads/\" reference namespace" },
257 24278f30 2019-08-03 stsp { GOT_ERR_FILE_STAGED, "file is staged" },
258 d3e7c587 2019-08-03 stsp { GOT_ERR_STAGE_NO_CHANGE, "no changes to stage" },
259 ebf48fd5 2019-08-03 stsp { GOT_ERR_STAGE_CONFLICT, "cannot stage file in conflicted status" },
260 735ef5ac 2019-08-03 stsp { GOT_ERR_STAGE_OUT_OF_DATE, "work tree must be updated before "
261 735ef5ac 2019-08-03 stsp "changes can be staged" },
262 f0b75401 2019-08-03 stsp { GOT_ERR_FILE_NOT_STAGED, "file is not staged" },
263 f032f1f7 2019-08-04 stsp { GOT_ERR_STAGED_PATHS, "work tree contains files with staged "
264 f032f1f7 2019-08-04 stsp "changes; these changes must be committed or unstaged first" },
265 dc424a06 2019-08-07 stsp { GOT_ERR_PATCH_CHOICE, "invalid patch choice" },
266 84792843 2019-08-09 stsp { GOT_ERR_COMMIT_NO_EMAIL,"GOT_AUTHOR environment variable contains "
267 84792843 2019-08-09 stsp "no email address; an email address is required for compatibility "
268 84792843 2019-08-09 stsp "with Git" },
269 8e7bd50a 2019-08-22 stsp { GOT_ERR_TAG_EXISTS,"specified tag already exists" },
270 aba9c984 2019-09-08 stsp { GOT_ERR_GIT_REPO_FORMAT,"unknown git repository format version" },
271 2822a352 2019-10-15 stsp { GOT_ERR_REBASE_REQUIRED,"specified branch must be rebased first" },
272 6d17833f 2019-11-08 stsp { GOT_ERR_REGEX, "regular expression error" },
273 bd5895f3 2019-11-28 stsp { GOT_ERR_REF_NAME_MINUS, "reference name may not start with '-'" },
274 cd95becd 2019-11-29 stsp { GOT_ERR_GITCONFIG_SYNTAX, "gitconfig syntax error" },
275 e51d7b55 2020-01-04 stsp { GOT_ERR_REBASE_OUT_OF_DATE, "work tree must be updated before it "
276 e51d7b55 2020-01-04 stsp "can be used to rebase a branch" },
277 e1a68182 2020-01-07 stsp { GOT_ERR_CACHE_DUP_ENTRY, "duplicate cache entry" },
278 9f33591a 2020-02-14 tracey { GOT_ERR_QUERYSTRING, "bad querystring" },
279 93658fb9 2020-03-18 stsp { GOT_ERR_FETCH_FAILED, "fetch failed" },
280 93658fb9 2020-03-18 stsp { GOT_ERR_PARSE_URI, "failed to parse uri" },
281 93658fb9 2020-03-18 stsp { GOT_ERR_BAD_PROTO, "unknown protocol" },
282 5cc27ede 2020-03-18 stsp { GOT_ERR_ADDRINFO, "getaddrinfo failed" },
283 fe53745c 2020-03-18 stsp { GOT_ERR_BAD_PACKET, "bad packet received" },
284 7848a0e1 2020-03-19 stsp { GOT_ERR_NO_REMOTE, "remote repository not found" },
285 4027f31a 2017-11-04 stsp };
286 4027f31a 2017-11-04 stsp
287 0c60ce5a 2018-04-02 stsp /*
288 0c60ce5a 2018-04-02 stsp * Get an error object from the above list, for a given error code.
289 0c60ce5a 2018-04-02 stsp * The error message is fixed.
290 0c60ce5a 2018-04-02 stsp */
291 0c60ce5a 2018-04-02 stsp const struct got_error *got_error(int);
292 0c60ce5a 2018-04-02 stsp
293 0c60ce5a 2018-04-02 stsp /*
294 91a3d81f 2018-11-11 stsp * Get an error object from the above list, for a given error code.
295 91a3d81f 2018-11-11 stsp * Use the specified error message instead of the default one.
296 91a3d81f 2018-11-11 stsp * Caution: If the message buffer lives in dynamically allocated memory,
297 91a3d81f 2018-11-11 stsp * then this memory likely won't be freed.
298 91a3d81f 2018-11-11 stsp */
299 91a3d81f 2018-11-11 stsp const struct got_error *got_error_msg(int, const char *);
300 91a3d81f 2018-11-11 stsp
301 91a3d81f 2018-11-11 stsp /*
302 0c60ce5a 2018-04-02 stsp * Get a statically allocated error object with code GOT_ERR_ERRNO
303 230a42bd 2019-05-11 jcs * and an error message obtained from strerror(3), prefixed with a
304 230a42bd 2019-05-11 jcs * string.
305 0c60ce5a 2018-04-02 stsp */
306 638f9024 2019-05-13 stsp const struct got_error *got_error_from_errno(const char *);
307 0c60ce5a 2018-04-02 stsp
308 0c60ce5a 2018-04-02 stsp /*
309 48b8b0eb 2019-05-11 jcs * Get a statically allocated error object with code GOT_ERR_ERRNO
310 230a42bd 2019-05-11 jcs * and an error message obtained from strerror(3), prefixed with two
311 230a42bd 2019-05-11 jcs * strings.
312 48b8b0eb 2019-05-11 jcs */
313 638f9024 2019-05-13 stsp const struct got_error *got_error_from_errno2(const char *, const char *);
314 48b8b0eb 2019-05-11 jcs
315 48b8b0eb 2019-05-11 jcs /*
316 230a42bd 2019-05-11 jcs * Get a statically allocated error object with code GOT_ERR_ERRNO
317 230a42bd 2019-05-11 jcs * and an error message obtained from strerror(3), prefixed with three
318 230a42bd 2019-05-11 jcs * strings.
319 230a42bd 2019-05-11 jcs */
320 638f9024 2019-05-13 stsp const struct got_error *got_error_from_errno3(const char *, const char *,
321 230a42bd 2019-05-11 jcs const char *);
322 230a42bd 2019-05-11 jcs
323 230a42bd 2019-05-11 jcs /*
324 1a76625f 2018-10-22 stsp * Set errno to the specified error code and return a statically
325 1a76625f 2018-10-22 stsp * allocated error object with code GOT_ERR_ERRNO and an error
326 2af4a041 2019-05-11 jcs * message obtained from strerror(3), optionally prefixed with a
327 2af4a041 2019-05-11 jcs * string.
328 1a76625f 2018-10-22 stsp */
329 2af4a041 2019-05-11 jcs const struct got_error *got_error_set_errno(int, const char *);
330 1a76625f 2018-10-22 stsp
331 1a76625f 2018-10-22 stsp /*
332 0c60ce5a 2018-04-02 stsp * If ferror(3) indicates an error status for the FILE, obtain an error
333 638f9024 2019-05-13 stsp * from got_error_from_errno(). Else, obtain the error via got_error()
334 0c60ce5a 2018-04-02 stsp * with the error code provided in the second argument.
335 0c60ce5a 2018-04-02 stsp */
336 8251fdbc 2018-01-12 stsp const struct got_error *got_ferror(FILE *, int);
337 91a3d81f 2018-11-11 stsp
338 91a3d81f 2018-11-11 stsp /*
339 91a3d81f 2018-11-11 stsp * Obtain an error with code GOT_ERR_NO_OBJ and an error message which
340 91a3d81f 2018-11-11 stsp * contains the specified object ID. The message buffer is statically
341 91a3d81f 2018-11-11 stsp * allocated; future invocations of this function will overwrite the
342 91a3d81f 2018-11-11 stsp * message set during earlier invocations.
343 91a3d81f 2018-11-11 stsp */
344 91a3d81f 2018-11-11 stsp struct got_object_id; /* forward declaration */
345 91a3d81f 2018-11-11 stsp const struct got_error *got_error_no_obj(struct got_object_id *);
346 2aa0475c 2019-02-03 stsp
347 2aa0475c 2019-02-03 stsp /*
348 2aa0475c 2019-02-03 stsp * Obtain an error with code GOT_ERR_NOT_REF and an error message which
349 2aa0475c 2019-02-03 stsp * contains the specified reference name. The message buffer is statically
350 2aa0475c 2019-02-03 stsp * allocated; future invocations of this function will overwrite the
351 2aa0475c 2019-02-03 stsp * message set during earlier invocations.
352 2aa0475c 2019-02-03 stsp */
353 2aa0475c 2019-02-03 stsp const struct got_error *got_error_not_ref(const char *);
354 09589288 2019-03-10 stsp
355 09589288 2019-03-10 stsp /* Return an error based on a uuid(3) status code. */
356 cc483380 2019-09-01 stsp const struct got_error *got_error_uuid(uint32_t, const char *);
357 df056ada 2019-05-15 stsp
358 df056ada 2019-05-15 stsp /* Return an error with a path prefixed to the error message. */
359 df056ada 2019-05-15 stsp const struct got_error *got_error_path(const char *, int);