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.
23 struct got_object_id
*base_commit_id
;
28 * File descriptor for the lock file, open while a work tree is open.
29 * When a work tree is opened, a shared lock on the lock file is
30 * acquired with flock(2). This shared lock is held until the work
31 * tree is closed, i.e. throughout the lifetime of any operation
32 * which uses a work tree.
33 * Before any modifications are made to the on-disk state of work
34 * tree meta data, tracked files, or directory tree structure, this
35 * shared lock must be upgraded to an exclusive lock.
39 /* Absolute path to worktree's got.conf file. */
42 /* Settings read from got.conf. */
43 struct got_gotconfig
*gotconfig
;
46 struct got_commitable
{
51 unsigned char staged_status
;
52 struct got_object_id
*blob_id
;
53 struct got_object_id
*base_blob_id
;
54 struct got_object_id
*staged_blob_id
;
55 struct got_object_id
*base_commit_id
;
58 #define GOT_COMMITABLE_ADDED 0x01
61 /* Also defined in got_worktree.h */
62 #ifndef GOT_WORKTREE_GOT_DIR
63 #define GOT_WORKTREE_GOT_DIR ".got"
65 #ifndef GOT_WORKTREE_CVG_DIR
66 #define GOT_WORKTREE_CVG_DIR ".cvg"
69 #define GOT_WORKTREE_FILE_INDEX "file-index"
70 #define GOT_WORKTREE_REPOSITORY "repository"
71 #define GOT_WORKTREE_PATH_PREFIX "path-prefix"
72 #define GOT_WORKTREE_HEAD_REF "head-ref"
73 #define GOT_WORKTREE_BASE_COMMIT "base-commit"
74 #define GOT_WORKTREE_LOCK "lock"
75 #define GOT_WORKTREE_FORMAT "format"
76 #define GOT_WORKTREE_UUID "uuid"
77 #define GOT_WORKTREE_HISTEDIT_SCRIPT "histedit-script"
79 #define GOT_WORKTREE_FORMAT_VERSION 1
80 #define GOT_WORKTREE_INVALID_COMMIT_ID GOT_SHA1_STRING_ZERO
82 #define GOT_WORKTREE_BASE_REF_PREFIX "refs/got/worktree/base"
84 /* Temporary branch which accumulates commits during a rebase operation. */
85 #define GOT_WORKTREE_REBASE_TMP_REF_PREFIX "refs/got/worktree/rebase/tmp"
87 /* Symbolic reference pointing at the name of the new base branch. */
88 #define GOT_WORKTREE_NEWBASE_REF_PREFIX "refs/got/worktree/rebase/newbase"
90 /* Symbolic reference pointing at the name of the branch being rebased. */
91 #define GOT_WORKTREE_REBASE_BRANCH_REF_PREFIX "refs/got/worktree/rebase/branch"
93 /* Reference pointing at the ID of the current commit being rebased. */
94 #define GOT_WORKTREE_REBASE_COMMIT_REF_PREFIX "refs/got/worktree/rebase/commit"
96 /* Temporary branch which accumulates commits during a histedit operation. */
97 #define GOT_WORKTREE_HISTEDIT_TMP_REF_PREFIX "refs/got/worktree/histedit/tmp"
99 /* Symbolic reference pointing at the name of the branch being edited. */
100 #define GOT_WORKTREE_HISTEDIT_BRANCH_REF_PREFIX \
101 "refs/got/worktree/histedit/branch"
103 /* Reference pointing at the ID of the work tree's pre-edit base commit. */
104 #define GOT_WORKTREE_HISTEDIT_BASE_COMMIT_REF_PREFIX \
105 "refs/got/worktree/histedit/base-commit"
107 /* Reference pointing at the ID of the current commit being edited. */
108 #define GOT_WORKTREE_HISTEDIT_COMMIT_REF_PREFIX \
109 "refs/got/worktree/histedit/commit"
111 /* Symbolic reference pointing at the name of the merge source branch. */
112 #define GOT_WORKTREE_MERGE_BRANCH_REF_PREFIX "refs/got/worktree/merge/branch"
114 /* Reference pointing at the ID of the merge source branches's tip commit. */
115 #define GOT_WORKTREE_MERGE_COMMIT_REF_PREFIX "refs/got/worktree/merge/commit"
117 /* Reference pointing to temporary commits that may need trivial rebasing. */
118 #define GOT_WORKTREE_COMMIT_REF_PREFIX "refs/got/worktree/commit"