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.
25 * File descriptor for the lock file, open while a work tree is open.
26 * When a work tree is opened, a shared lock on the lock file is
27 * acquired with flock(2). This shared lock is held until the work
28 * tree is closed, i.e. throughout the lifetime of any operation
29 * which uses a work tree.
30 * Before any modifications are made to the on-disk state of work
31 * tree meta data, tracked files, or directory tree structure, this
32 * shared lock must be upgraded to an exclusive lock.
37 #define GOT_WORKTREE_GOT_DIR ".got"
38 #define GOT_WORKTREE_FILE_INDEX "fileindex"
39 #define GOT_WORKTREE_REPOSITORY "repository"
40 #define GOT_WORKTREE_PATH_PREFIX "path-prefix"
41 #define GOT_WORKTREE_HEAD "head"
42 #define GOT_WORKTREE_BASE "base"
43 #define GOT_WORKTREE_LOCK "lock"
44 #define GOT_WORKTREE_FORMAT "format"
46 #define GOT_WORKTREE_FORMAT_VERSION 1
47 #define GOT_WORKTREE_INVALID_COMMIT_ID GOT_SHA1_STRING_ZERO