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 .Nd got worktree format
25 stores a file hierarchy which corresponds to a versioned
26 snapshot stored in a Git repository.
27 The work tree's meta data is stored in the
30 A work tree is created with
32 and is required to make changes to a Git repository with
35 A work tree stores the path to its Git repository, the name of a reference
36 to the branch which files were checked out from, and the ID of a commit on
37 this branch known as the
40 File meta-data is stored in a structured file called the
42 and tracks the status of file modifications, additions, and deletions,
43 relative to the base commit in the repository.
44 The file index contains a series of records, and each such record contains
45 the following status information for a particular file:
47 .It Copy of filesystem meta-data
48 Timestamp, file size, and file ownership information from
50 This is only used to detect file modifications and is never applied
51 back to the filesystem.
52 File permissions are not tracked, except for the executable bit.
53 When versioned files are checked out into the work tree, the current
57 The SHA1 hash of the blob object which corresponds to the contents
58 of this file in the repository.
59 The hash is stored as binary data.
61 The SHA1 hash of the commit object the file was checked out from.
62 The hash is stored as binary data.
63 This data is used to detect past incomplete update operations.
64 Entries which do not match the work tree's base commit may still need
65 to be updated to match file content stored in the base commit.
67 A flags field (intentionally not documented).
69 The path of the entry, relative to the work tree root.
70 Path data is of variable length and NUL-padded to a multiple of 8 bytes.
73 A corrupt or missing file index can be recreated on demand with
75 When the file index is modified, it is read into memory in its entirety,
76 modified in place, and written to a temporary file.
77 This temporary file is then moved on top of the old file index with
79 This ensures that no other processes see an inconsistent file index
80 which is in the process of being written.
82 Work tree meta data must only be modified while the work tree's
84 file has been exclusively locked with
87 Each work tree has a universal unique identifier.
88 When a work tree is checked out or updated, this identifier is used to
89 create a reference to the current base commit in the Git repository.
90 The presence of this reference prevents Git garbage collectors from
91 discarding the base commit and any objects it refers to.
92 When a work tree is no longer needed its reference can be deleted from
93 the Git repository with
96 .Bl -tag -width path-prefix -compact
98 Meta-data directory where all files listed below reside.
100 SHA1 hex-string representation of the current base commit.
102 File status information.
104 Work tree format number.
106 Name of the reference to the current branch.
108 Lock file to obtain exclusive write access to meta data.
110 Path inside repository the work tree was checked out from.
112 Path to the repository the work tree was checked out from.
114 A universal unique identifier for the work tree.