Blame


1 86c3caaf 2018-03-09 stsp /*
2 86c3caaf 2018-03-09 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 86c3caaf 2018-03-09 stsp *
4 86c3caaf 2018-03-09 stsp * Permission to use, copy, modify, and distribute this software for any
5 86c3caaf 2018-03-09 stsp * purpose with or without fee is hereby granted, provided that the above
6 86c3caaf 2018-03-09 stsp * copyright notice and this permission notice appear in all copies.
7 86c3caaf 2018-03-09 stsp *
8 86c3caaf 2018-03-09 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 86c3caaf 2018-03-09 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 86c3caaf 2018-03-09 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 86c3caaf 2018-03-09 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 86c3caaf 2018-03-09 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 86c3caaf 2018-03-09 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 86c3caaf 2018-03-09 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 86c3caaf 2018-03-09 stsp */
16 86c3caaf 2018-03-09 stsp
17 86c3caaf 2018-03-09 stsp #include <sys/stat.h>
18 6d9d28c3 2018-03-11 stsp #include <sys/limits.h>
19 86c3caaf 2018-03-09 stsp
20 86c3caaf 2018-03-09 stsp #include <string.h>
21 86c3caaf 2018-03-09 stsp #include <stdio.h>
22 86c3caaf 2018-03-09 stsp #include <stdlib.h>
23 86c3caaf 2018-03-09 stsp #include <fcntl.h>
24 86c3caaf 2018-03-09 stsp #include <errno.h>
25 86c3caaf 2018-03-09 stsp #include <unistd.h>
26 86c3caaf 2018-03-09 stsp
27 86c3caaf 2018-03-09 stsp #include "got_error.h"
28 86c3caaf 2018-03-09 stsp #include "got_repository.h"
29 86c3caaf 2018-03-09 stsp #include "got_refs.h"
30 86c3caaf 2018-03-09 stsp #include "got_worktree.h"
31 86c3caaf 2018-03-09 stsp
32 86c3caaf 2018-03-09 stsp #include "got_worktree_priv.h"
33 86c3caaf 2018-03-09 stsp #include "got_path_priv.h"
34 65e3b818 2018-03-11 stsp #include "got_sha1_priv.h"
35 86c3caaf 2018-03-09 stsp
36 99724ed4 2018-03-10 stsp static const struct got_error *
37 7ac97322 2018-03-11 stsp create_meta_file(const char *path_got, const char *name, const char *content)
38 99724ed4 2018-03-10 stsp {
39 99724ed4 2018-03-10 stsp const struct got_error *err = NULL;
40 99724ed4 2018-03-10 stsp char *path;
41 99724ed4 2018-03-10 stsp int fd = -1;
42 99724ed4 2018-03-10 stsp char buf[4];
43 99724ed4 2018-03-10 stsp ssize_t n;
44 99724ed4 2018-03-10 stsp
45 7ac97322 2018-03-11 stsp if (asprintf(&path, "%s/%s", path_got, name) == -1) {
46 99724ed4 2018-03-10 stsp err = got_error(GOT_ERR_NO_MEM);
47 99724ed4 2018-03-10 stsp path = NULL;
48 99724ed4 2018-03-10 stsp goto done;
49 99724ed4 2018-03-10 stsp }
50 99724ed4 2018-03-10 stsp
51 73a5ef67 2018-03-11 stsp fd = open(path, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW,
52 99724ed4 2018-03-10 stsp GOT_DEFAULT_FILE_MODE);
53 99724ed4 2018-03-10 stsp if (fd == -1) {
54 99724ed4 2018-03-10 stsp err = got_error_from_errno();
55 99724ed4 2018-03-10 stsp goto done;
56 99724ed4 2018-03-10 stsp }
57 99724ed4 2018-03-10 stsp
58 99724ed4 2018-03-10 stsp /* The file should be empty. */
59 99724ed4 2018-03-10 stsp n = read(fd, buf, sizeof(buf));
60 99724ed4 2018-03-10 stsp if (n != 0) {
61 99724ed4 2018-03-10 stsp err = (n == -1 ? got_error_from_errno() :
62 99724ed4 2018-03-10 stsp got_error(GOT_ERR_WORKTREE_EXISTS));
63 99724ed4 2018-03-10 stsp goto done;
64 99724ed4 2018-03-10 stsp }
65 99724ed4 2018-03-10 stsp
66 99724ed4 2018-03-10 stsp if (content) {
67 99724ed4 2018-03-10 stsp int len = dprintf(fd, "%s\n", content);
68 99724ed4 2018-03-10 stsp if (len != strlen(content) + 1) {
69 99724ed4 2018-03-10 stsp err = got_error_from_errno();
70 99724ed4 2018-03-10 stsp goto done;
71 99724ed4 2018-03-10 stsp }
72 99724ed4 2018-03-10 stsp }
73 99724ed4 2018-03-10 stsp
74 99724ed4 2018-03-10 stsp done:
75 99724ed4 2018-03-10 stsp if (fd != -1 && close(fd) == -1 && err == NULL)
76 99724ed4 2018-03-10 stsp err = got_error_from_errno();
77 99724ed4 2018-03-10 stsp free(path);
78 99724ed4 2018-03-10 stsp return err;
79 99724ed4 2018-03-10 stsp }
80 99724ed4 2018-03-10 stsp
81 09fe317a 2018-03-11 stsp static const struct got_error *
82 7ac97322 2018-03-11 stsp read_meta_file(char **content, const char *path_got, const char *name)
83 09fe317a 2018-03-11 stsp {
84 09fe317a 2018-03-11 stsp const struct got_error *err = NULL;
85 09fe317a 2018-03-11 stsp char *path;
86 09fe317a 2018-03-11 stsp int fd = -1;
87 09fe317a 2018-03-11 stsp ssize_t n;
88 09fe317a 2018-03-11 stsp struct stat sb;
89 09fe317a 2018-03-11 stsp
90 09fe317a 2018-03-11 stsp *content = NULL;
91 09fe317a 2018-03-11 stsp
92 7ac97322 2018-03-11 stsp if (asprintf(&path, "%s/%s", path_got, name) == -1) {
93 09fe317a 2018-03-11 stsp err = got_error(GOT_ERR_NO_MEM);
94 09fe317a 2018-03-11 stsp path = NULL;
95 09fe317a 2018-03-11 stsp goto done;
96 09fe317a 2018-03-11 stsp }
97 09fe317a 2018-03-11 stsp
98 ef99fdb1 2018-03-11 stsp fd = open(path, O_RDONLY | O_NOFOLLOW);
99 09fe317a 2018-03-11 stsp if (fd == -1) {
100 ef99fdb1 2018-03-11 stsp err = got_error_from_errno();
101 ef99fdb1 2018-03-11 stsp goto done;
102 ef99fdb1 2018-03-11 stsp }
103 ef99fdb1 2018-03-11 stsp if (flock(fd, LOCK_SH | LOCK_NB) == -1) {
104 73a5ef67 2018-03-11 stsp err = (errno == EWOULDBLOCK ? got_error(GOT_ERR_WORKTREE_BUSY)
105 73a5ef67 2018-03-11 stsp : got_error_from_errno());
106 09fe317a 2018-03-11 stsp goto done;
107 09fe317a 2018-03-11 stsp }
108 09fe317a 2018-03-11 stsp
109 09fe317a 2018-03-11 stsp stat(path, &sb);
110 09fe317a 2018-03-11 stsp *content = calloc(1, sb.st_size);
111 09fe317a 2018-03-11 stsp if (*content == NULL) {
112 09fe317a 2018-03-11 stsp err = got_error(GOT_ERR_NO_MEM);
113 09fe317a 2018-03-11 stsp goto done;
114 09fe317a 2018-03-11 stsp }
115 09fe317a 2018-03-11 stsp
116 09fe317a 2018-03-11 stsp n = read(fd, *content, sb.st_size);
117 09fe317a 2018-03-11 stsp if (n != sb.st_size) {
118 0605801d 2018-03-11 stsp err = (n == -1 ? got_error_from_errno() :
119 0605801d 2018-03-11 stsp got_error(GOT_ERR_WORKTREE_META));
120 09fe317a 2018-03-11 stsp goto done;
121 09fe317a 2018-03-11 stsp }
122 09fe317a 2018-03-11 stsp if ((*content)[sb.st_size - 1] != '\n') {
123 09fe317a 2018-03-11 stsp err = got_error(GOT_ERR_WORKTREE_META);
124 09fe317a 2018-03-11 stsp goto done;
125 09fe317a 2018-03-11 stsp }
126 09fe317a 2018-03-11 stsp (*content)[sb.st_size - 1] = '\0';
127 09fe317a 2018-03-11 stsp
128 09fe317a 2018-03-11 stsp done:
129 09fe317a 2018-03-11 stsp if (fd != -1 && close(fd) == -1 && err == NULL)
130 09fe317a 2018-03-11 stsp err = got_error_from_errno();
131 09fe317a 2018-03-11 stsp free(path);
132 09fe317a 2018-03-11 stsp if (err) {
133 09fe317a 2018-03-11 stsp free(*content);
134 09fe317a 2018-03-11 stsp *content = NULL;
135 09fe317a 2018-03-11 stsp }
136 09fe317a 2018-03-11 stsp return err;
137 09fe317a 2018-03-11 stsp }
138 09fe317a 2018-03-11 stsp
139 86c3caaf 2018-03-09 stsp const struct got_error *
140 86c3caaf 2018-03-09 stsp got_worktree_init(const char *path, struct got_reference *head_ref,
141 577ec78f 2018-03-11 stsp const char *prefix, struct got_repository *repo)
142 86c3caaf 2018-03-09 stsp {
143 86c3caaf 2018-03-09 stsp const struct got_error *err = NULL;
144 7ac97322 2018-03-11 stsp char *path_got = NULL;
145 86c3caaf 2018-03-09 stsp char *refstr = NULL;
146 cde76477 2018-03-11 stsp char *repo_path = NULL;
147 1451e70d 2018-03-10 stsp char *formatstr = NULL;
148 86c3caaf 2018-03-09 stsp
149 577ec78f 2018-03-11 stsp if (!got_path_is_absolute(prefix))
150 577ec78f 2018-03-11 stsp return got_error(GOT_ERR_BAD_PATH);
151 577ec78f 2018-03-11 stsp
152 86c3caaf 2018-03-09 stsp /* Create top-level directory (may already exist). */
153 2cb4bacb 2018-03-11 stsp if (mkdir(path, GOT_DEFAULT_DIR_MODE) == -1 && errno != EEXIST) {
154 86c3caaf 2018-03-09 stsp err = got_error_from_errno();
155 86c3caaf 2018-03-09 stsp goto done;
156 86c3caaf 2018-03-09 stsp }
157 86c3caaf 2018-03-09 stsp
158 86c3caaf 2018-03-09 stsp /* Create .got directory (may already exist). */
159 7ac97322 2018-03-11 stsp if (asprintf(&path_got, "%s/%s", path, GOT_WORKTREE_GOT_DIR) == -1) {
160 86c3caaf 2018-03-09 stsp err = got_error(GOT_ERR_NO_MEM);
161 86c3caaf 2018-03-09 stsp goto done;
162 86c3caaf 2018-03-09 stsp }
163 7ac97322 2018-03-11 stsp if (mkdir(path_got, GOT_DEFAULT_DIR_MODE) == -1 && errno != EEXIST) {
164 86c3caaf 2018-03-09 stsp err = got_error_from_errno();
165 86c3caaf 2018-03-09 stsp goto done;
166 86c3caaf 2018-03-09 stsp }
167 86c3caaf 2018-03-09 stsp
168 056e7441 2018-03-11 stsp /* Create an empty lock file. */
169 7ac97322 2018-03-11 stsp err = create_meta_file(path_got, GOT_WORKTREE_LOCK, NULL);
170 056e7441 2018-03-11 stsp if (err)
171 056e7441 2018-03-11 stsp goto done;
172 056e7441 2018-03-11 stsp
173 86c3caaf 2018-03-09 stsp /* Create an empty file index. */
174 7ac97322 2018-03-11 stsp err = create_meta_file(path_got, GOT_WORKTREE_FILE_INDEX, NULL);
175 99724ed4 2018-03-10 stsp if (err)
176 86c3caaf 2018-03-09 stsp goto done;
177 86c3caaf 2018-03-09 stsp
178 65e3b818 2018-03-11 stsp /* Save an invalid base commit hash. */
179 65e3b818 2018-03-11 stsp err = create_meta_file(path_got, GOT_WORKTREE_BASE_COMMIT,
180 65e3b818 2018-03-11 stsp GOT_WORKTREE_INVALID_COMMIT_ID);
181 e350ead3 2018-03-11 stsp if (err)
182 e350ead3 2018-03-11 stsp goto done;
183 e350ead3 2018-03-11 stsp
184 86c3caaf 2018-03-09 stsp /* Write the HEAD reference. */
185 86c3caaf 2018-03-09 stsp refstr = got_ref_to_str(head_ref);
186 86c3caaf 2018-03-09 stsp if (refstr == NULL) {
187 86c3caaf 2018-03-09 stsp err = got_error(GOT_ERR_NO_MEM);
188 86c3caaf 2018-03-09 stsp goto done;
189 86c3caaf 2018-03-09 stsp }
190 7ac97322 2018-03-11 stsp err = create_meta_file(path_got, GOT_WORKTREE_HEAD, refstr);
191 99724ed4 2018-03-10 stsp if (err)
192 86c3caaf 2018-03-09 stsp goto done;
193 86c3caaf 2018-03-09 stsp
194 1451e70d 2018-03-10 stsp /* Store path to repository. */
195 cde76477 2018-03-11 stsp repo_path = got_repo_get_path(repo);
196 cde76477 2018-03-11 stsp if (repo_path == NULL) {
197 86c3caaf 2018-03-09 stsp err = got_error(GOT_ERR_NO_MEM);
198 86c3caaf 2018-03-09 stsp goto done;
199 86c3caaf 2018-03-09 stsp }
200 cde76477 2018-03-11 stsp err = create_meta_file(path_got, GOT_WORKTREE_REPOSITORY, repo_path);
201 99724ed4 2018-03-10 stsp if (err)
202 86c3caaf 2018-03-09 stsp goto done;
203 86c3caaf 2018-03-09 stsp
204 577ec78f 2018-03-11 stsp /* Store in-repository path prefix. */
205 7ac97322 2018-03-11 stsp err = create_meta_file(path_got, GOT_WORKTREE_PATH_PREFIX, prefix);
206 577ec78f 2018-03-11 stsp if (err)
207 577ec78f 2018-03-11 stsp goto done;
208 577ec78f 2018-03-11 stsp
209 9dce68ed 2018-03-10 stsp /* Stamp work tree with format file. */
210 1451e70d 2018-03-10 stsp if (asprintf(&formatstr, "%d", GOT_WORKTREE_FORMAT_VERSION) == -1) {
211 1451e70d 2018-03-10 stsp err = got_error(GOT_ERR_NO_MEM);
212 1451e70d 2018-03-10 stsp goto done;
213 1451e70d 2018-03-10 stsp }
214 7ac97322 2018-03-11 stsp err = create_meta_file(path_got, GOT_WORKTREE_FORMAT, formatstr);
215 99724ed4 2018-03-10 stsp if (err)
216 1451e70d 2018-03-10 stsp goto done;
217 1451e70d 2018-03-10 stsp
218 86c3caaf 2018-03-09 stsp done:
219 7ac97322 2018-03-11 stsp free(path_got);
220 1451e70d 2018-03-10 stsp free(formatstr);
221 86c3caaf 2018-03-09 stsp free(refstr);
222 cde76477 2018-03-11 stsp free(repo_path);
223 86c3caaf 2018-03-09 stsp return err;
224 86c3caaf 2018-03-09 stsp }
225 86c3caaf 2018-03-09 stsp
226 86c3caaf 2018-03-09 stsp const struct got_error *
227 86c3caaf 2018-03-09 stsp got_worktree_open(struct got_worktree **worktree, const char *path)
228 86c3caaf 2018-03-09 stsp {
229 6d9d28c3 2018-03-11 stsp const struct got_error *err = NULL;
230 7ac97322 2018-03-11 stsp char *path_got;
231 6d9d28c3 2018-03-11 stsp char *refstr = NULL;
232 6d9d28c3 2018-03-11 stsp char *formatstr = NULL;
233 056e7441 2018-03-11 stsp char *path_lock = NULL;
234 6d9d28c3 2018-03-11 stsp int version, fd = -1;
235 6d9d28c3 2018-03-11 stsp const char *errstr;
236 6d9d28c3 2018-03-11 stsp
237 6d9d28c3 2018-03-11 stsp *worktree = NULL;
238 6d9d28c3 2018-03-11 stsp
239 7ac97322 2018-03-11 stsp if (asprintf(&path_got, "%s/%s", path, GOT_WORKTREE_GOT_DIR) == -1) {
240 6d9d28c3 2018-03-11 stsp err = got_error(GOT_ERR_NO_MEM);
241 7ac97322 2018-03-11 stsp path_got = NULL;
242 6d9d28c3 2018-03-11 stsp goto done;
243 6d9d28c3 2018-03-11 stsp }
244 6d9d28c3 2018-03-11 stsp
245 7ac97322 2018-03-11 stsp if (asprintf(&path_lock, "%s/%s", path_got, GOT_WORKTREE_LOCK) == -1) {
246 6d9d28c3 2018-03-11 stsp err = got_error(GOT_ERR_NO_MEM);
247 056e7441 2018-03-11 stsp path_lock = NULL;
248 6d9d28c3 2018-03-11 stsp goto done;
249 6d9d28c3 2018-03-11 stsp }
250 6d9d28c3 2018-03-11 stsp
251 056e7441 2018-03-11 stsp fd = open(path_lock, O_RDWR | O_EXLOCK | O_NONBLOCK);
252 6d9d28c3 2018-03-11 stsp if (fd == -1) {
253 73a5ef67 2018-03-11 stsp err = (errno == EWOULDBLOCK ? got_error(GOT_ERR_WORKTREE_BUSY)
254 73a5ef67 2018-03-11 stsp : got_error_from_errno());
255 6d9d28c3 2018-03-11 stsp goto done;
256 6d9d28c3 2018-03-11 stsp }
257 6d9d28c3 2018-03-11 stsp
258 7ac97322 2018-03-11 stsp err = read_meta_file(&formatstr, path_got, GOT_WORKTREE_FORMAT);
259 6d9d28c3 2018-03-11 stsp if (err)
260 6d9d28c3 2018-03-11 stsp goto done;
261 6d9d28c3 2018-03-11 stsp
262 6d9d28c3 2018-03-11 stsp version = strtonum(formatstr, 1, INT_MAX, &errstr);
263 6d9d28c3 2018-03-11 stsp if (errstr) {
264 6d9d28c3 2018-03-11 stsp err = got_error(GOT_ERR_WORKTREE_META);
265 6d9d28c3 2018-03-11 stsp goto done;
266 6d9d28c3 2018-03-11 stsp }
267 6d9d28c3 2018-03-11 stsp if (version != GOT_WORKTREE_FORMAT_VERSION) {
268 6d9d28c3 2018-03-11 stsp err = got_error(GOT_ERR_WORKTREE_VERS);
269 6d9d28c3 2018-03-11 stsp goto done;
270 6d9d28c3 2018-03-11 stsp }
271 6d9d28c3 2018-03-11 stsp
272 6d9d28c3 2018-03-11 stsp *worktree = calloc(1, sizeof(**worktree));
273 6d9d28c3 2018-03-11 stsp if (*worktree == NULL) {
274 6d9d28c3 2018-03-11 stsp err = got_error(GOT_ERR_NO_MEM);
275 6d9d28c3 2018-03-11 stsp goto done;
276 6d9d28c3 2018-03-11 stsp }
277 056e7441 2018-03-11 stsp (*worktree)->lockfd = -1;
278 6d9d28c3 2018-03-11 stsp
279 c88eb298 2018-03-11 stsp (*worktree)->root_path = strdup(path);
280 c88eb298 2018-03-11 stsp if ((*worktree)->root_path == NULL) {
281 6d9d28c3 2018-03-11 stsp err = got_error(GOT_ERR_NO_MEM);
282 6d9d28c3 2018-03-11 stsp goto done;
283 6d9d28c3 2018-03-11 stsp }
284 cde76477 2018-03-11 stsp err = read_meta_file(&(*worktree)->repo_path, path_got,
285 6d9d28c3 2018-03-11 stsp GOT_WORKTREE_REPOSITORY);
286 6d9d28c3 2018-03-11 stsp if (err)
287 6d9d28c3 2018-03-11 stsp goto done;
288 7ac97322 2018-03-11 stsp err = read_meta_file(&(*worktree)->path_prefix, path_got,
289 6d9d28c3 2018-03-11 stsp GOT_WORKTREE_PATH_PREFIX);
290 f5baf295 2018-03-11 stsp if (err)
291 f5baf295 2018-03-11 stsp goto done;
292 f5baf295 2018-03-11 stsp
293 f5baf295 2018-03-11 stsp err = read_meta_file(&(*worktree)->base_commit, path_got,
294 f5baf295 2018-03-11 stsp GOT_WORKTREE_BASE_COMMIT);
295 e8f36958 2018-03-11 stsp if (err)
296 e8f36958 2018-03-11 stsp goto done;
297 e8f36958 2018-03-11 stsp
298 e8f36958 2018-03-11 stsp err = read_meta_file(&(*worktree)->head_ref, path_got,
299 e8f36958 2018-03-11 stsp GOT_WORKTREE_HEAD);
300 f5baf295 2018-03-11 stsp if (err)
301 6d9d28c3 2018-03-11 stsp goto done;
302 6d9d28c3 2018-03-11 stsp
303 6d9d28c3 2018-03-11 stsp done:
304 7ac97322 2018-03-11 stsp free(path_got);
305 056e7441 2018-03-11 stsp free(path_lock);
306 6d9d28c3 2018-03-11 stsp if (err) {
307 6d9d28c3 2018-03-11 stsp if (fd != -1)
308 6d9d28c3 2018-03-11 stsp close(fd);
309 6d9d28c3 2018-03-11 stsp if (*worktree != NULL)
310 6d9d28c3 2018-03-11 stsp got_worktree_close(*worktree);
311 6d9d28c3 2018-03-11 stsp *worktree = NULL;
312 6d9d28c3 2018-03-11 stsp } else
313 056e7441 2018-03-11 stsp (*worktree)->lockfd = fd;
314 6d9d28c3 2018-03-11 stsp
315 6d9d28c3 2018-03-11 stsp return err;
316 86c3caaf 2018-03-09 stsp }
317 86c3caaf 2018-03-09 stsp
318 86c3caaf 2018-03-09 stsp void
319 86c3caaf 2018-03-09 stsp got_worktree_close(struct got_worktree *worktree)
320 86c3caaf 2018-03-09 stsp {
321 c88eb298 2018-03-11 stsp free(worktree->root_path);
322 cde76477 2018-03-11 stsp free(worktree->repo_path);
323 6d9d28c3 2018-03-11 stsp free(worktree->path_prefix);
324 d6c38e0d 2018-03-11 stsp free(worktree->base_commit);
325 e8f36958 2018-03-11 stsp free(worktree->head_ref);
326 056e7441 2018-03-11 stsp if (worktree->lockfd != -1)
327 056e7441 2018-03-11 stsp close(worktree->lockfd);
328 6d9d28c3 2018-03-11 stsp free(worktree);
329 86c3caaf 2018-03-09 stsp }
330 86c3caaf 2018-03-09 stsp
331 86c3caaf 2018-03-09 stsp char *
332 86c3caaf 2018-03-09 stsp got_worktree_get_repo_path(struct got_worktree *worktree)
333 86c3caaf 2018-03-09 stsp {
334 cde76477 2018-03-11 stsp return strdup(worktree->repo_path);
335 86c3caaf 2018-03-09 stsp }
336 86c3caaf 2018-03-09 stsp
337 86c3caaf 2018-03-09 stsp struct got_reference *
338 86c3caaf 2018-03-09 stsp got_worktree_get_head(struct got_worktree *worktree)
339 86c3caaf 2018-03-09 stsp {
340 86c3caaf 2018-03-09 stsp return NULL;
341 86c3caaf 2018-03-09 stsp }
342 86c3caaf 2018-03-09 stsp
343 86c3caaf 2018-03-09 stsp const struct got_error *
344 4d94df2d 2018-03-11 stsp got_worktree_change_head(struct got_worktree *worktree, struct got_reference *head,
345 86c3caaf 2018-03-09 stsp struct got_repository *repo)
346 86c3caaf 2018-03-09 stsp {
347 86c3caaf 2018-03-09 stsp return NULL;
348 86c3caaf 2018-03-09 stsp }
349 86c3caaf 2018-03-09 stsp
350 86c3caaf 2018-03-09 stsp const struct got_error *
351 86c3caaf 2018-03-09 stsp got_worktree_checkout_files(struct got_worktree *worktree,
352 86c3caaf 2018-03-09 stsp struct got_repository *repo)
353 86c3caaf 2018-03-09 stsp {
354 86c3caaf 2018-03-09 stsp return NULL;
355 86c3caaf 2018-03-09 stsp }