Blame


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