2 * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 struct got_object_id *base_commit_id;
26 * File descriptor for the lock file, open while a work tree is open.
27 * When a work tree is opened, a shared lock on the lock file is
28 * acquired with flock(2). This shared lock is held until the work
29 * tree is closed, i.e. throughout the lifetime of any operation
30 * which uses a work tree.
31 * Before any modifications are made to the on-disk state of work
32 * tree meta data, tracked files, or directory tree structure, this
33 * shared lock must be upgraded to an exclusive lock.
38 struct got_commitable {
43 struct got_object_id *blob_id;
44 struct got_object_id *base_blob_id;
45 struct got_object_id *base_commit_id;
48 #define GOT_COMMITABLE_ADDED 0x01
51 #define GOT_WORKTREE_GOT_DIR ".got"
52 #define GOT_WORKTREE_FILE_INDEX "file-index"
53 #define GOT_WORKTREE_REPOSITORY "repository"
54 #define GOT_WORKTREE_PATH_PREFIX "path-prefix"
55 #define GOT_WORKTREE_HEAD_REF "head-ref"
56 #define GOT_WORKTREE_BASE_COMMIT "base-commit"
57 #define GOT_WORKTREE_LOCK "lock"
58 #define GOT_WORKTREE_FORMAT "format"
59 #define GOT_WORKTREE_UUID "uuid"
61 #define GOT_WORKTREE_FORMAT_VERSION 1
62 #define GOT_WORKTREE_INVALID_COMMIT_ID GOT_SHA1_STRING_ZERO
64 #define GOT_WORKTREE_BASE_REF_PREFIX "got/worktree/base"
66 const struct got_error *got_worktree_get_base_ref_name(char **,
67 struct got_worktree *worktree);