Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 417d67e

Browse filesBrowse files
dschoderrickstolee
authored andcommitted
Merge updates to serialized status
Includes these pull requests: #1 #6 #10 #11 #157 #212 #260 #270 Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
2 parents 9589880 + 641c814 commit 417d67e
Copy full SHA for 417d67e
Expand file treeCollapse file tree

18 files changed

+2239
-31
lines changed
Open diff view settings
Collapse file

‎Documentation/config/status.txt‎

Copy file name to clipboardExpand all lines: Documentation/config/status.txt
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,25 @@ status.submoduleSummary::
7575
the --ignore-submodules=dirty command-line option or the 'git
7676
submodule summary' command, which shows a similar output but does
7777
not honor these settings.
78+
79+
status.deserializePath::
80+
EXPERIMENTAL, Pathname to a file containing cached status results
81+
generated by `--serialize`. This will be overridden by
82+
`--deserialize=<path>` on the command line. If the cache file is
83+
invalid or stale, git will fall-back and compute status normally.
84+
85+
status.deserializeWait::
86+
EXPERIMENTAL, Specifies what `git status --deserialize` should do
87+
if the serialization cache file is stale and whether it should
88+
fall-back and compute status normally. This will be overridden by
89+
`--deserialize-wait=<value>` on the command line.
90+
+
91+
--
92+
* `fail` - cause git to exit with an error when the status cache file
93+
is stale; this is intended for testing and debugging.
94+
* `block` - cause git to spin and periodically retry the cache file
95+
every 100 ms; this is intended to help coordinate with another git
96+
instance concurrently computing the cache file.
97+
* `no` - to immediately fall-back if cache file is stale. This is the default.
98+
* `<timeout>` - time (in tenths of a second) to spin and retry.
99+
--
Collapse file

‎Documentation/git-status.txt‎

Copy file name to clipboardExpand all lines: Documentation/git-status.txt
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,21 @@ ignored, then the directory is not shown, but all contents are shown.
156156
update it afterwards if any changes were detected. Defaults to
157157
`--lock-index`.
158158

159+
--serialize[=<path>]::
160+
(EXPERIMENTAL) Serialize raw status results to a file or stdout
161+
in a format suitable for use by `--deserialize`. If a path is
162+
given, serialize data will be written to that path *and* normal
163+
status output will be written to stdout. If path is omitted,
164+
only binary serialization data will be written to stdout.
165+
166+
--deserialize[=<path>]::
167+
(EXPERIMENTAL) Deserialize raw status results from a file or
168+
stdin rather than scanning the worktree. If `<path>` is omitted
169+
and `status.deserializePath` is unset, input is read from stdin.
170+
--no-deserialize::
171+
(EXPERIMENTAL) Disable implicit deserialization of status results
172+
from the value of `status.deserializePath`.
173+
159174
<pathspec>...::
160175
See the 'pathspec' entry in linkgit:gitglossary[7].
161176

@@ -417,6 +432,26 @@ quoted as explained for the configuration variable `core.quotePath`
417432
(see linkgit:git-config[1]).
418433

419434

435+
SERIALIZATION and DESERIALIZATION (EXPERIMENTAL)
436+
------------------------------------------------
437+
438+
The `--serialize` option allows git to cache the result of a
439+
possibly time-consuming status scan to a binary file. A local
440+
service/daemon watching file system events could use this to
441+
periodically pre-compute a fresh status result.
442+
443+
Interactive users could then use `--deserialize` to simply
444+
(and immediately) print the last-known-good result without
445+
waiting for the status scan.
446+
447+
The binary serialization file format includes some worktree state
448+
information allowing `--deserialize` to reject the cached data
449+
and force a normal status scan if, for example, the commit, branch,
450+
or status modes/options change. The format cannot, however, indicate
451+
when the cached data is otherwise stale -- that coordination belongs
452+
to the task driving the serializations.
453+
454+
420455
CONFIGURATION
421456
-------------
422457

Collapse file
+107Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
Git status serialization format
2+
===============================
3+
4+
Git status serialization enables git to dump the results of a status scan
5+
to a binary file. This file can then be loaded by later status invocations
6+
to print the cached status results.
7+
8+
The file contains the essential fields from:
9+
() the index
10+
() the "struct wt_status" for the overall results
11+
() the contents of "struct wt_status_change_data" for tracked changed files
12+
() the list of untracked and ignored files
13+
14+
Version 1 Format:
15+
=================
16+
17+
The V1 file begins with a required header section followed by optional
18+
sections for each type of item (changed, untracked, ignored). Individual
19+
item sections are only present if necessary. Each item section begins
20+
with an item-type header with the number of items in the section.
21+
22+
Each "line" in the format is encoded using pkt-line with a final LF.
23+
Flush packets are used to terminate sections.
24+
25+
-----------------
26+
PKT-LINE("version" SP "1")
27+
<v1-header-section>
28+
[<v1-changed-item-section>]
29+
[<v1-untracked-item-section>]
30+
[<v1-ignored-item-section>]
31+
-----------------
32+
33+
34+
V1 Header
35+
---------
36+
37+
The v1-header-section fields are taken directly from "struct wt_status".
38+
Each field is printed on a separate pkt-line. Lines for NULL string
39+
values are omitted. All integers are printed with "%d". OIDs are
40+
printed in hex.
41+
42+
v1-header-section = <v1-index-headers>
43+
<v1-wt-status-headers>
44+
PKT-LINE(<flush>)
45+
46+
v1-index-headers = PKT-LINE("index_mtime" SP <sec> SP <nsec> LF)
47+
48+
v1-wt-status-headers = PKT-LINE("is_initial" SP <integer> LF)
49+
[ PKT-LINE("branch" SP <branch-name> LF) ]
50+
[ PKT-LINE("reference" SP <reference-name> LF) ]
51+
PKT-LINE("show_ignored_files" SP <integer> LF)
52+
PKT-LINE("show_untracked_files" SP <integer> LF)
53+
PKT-LINE("show_ignored_directory" SP <integer> LF)
54+
[ PKT-LINE("ignore_submodule_arg" SP <string> LF) ]
55+
PKT-LINE("detect_rename" SP <integer> LF)
56+
PKT-LINE("rename_score" SP <integer> LF)
57+
PKT-LINE("rename_limit" SP <integer> LF)
58+
PKT-LINE("detect_break" SP <integer> LF)
59+
PKT-LINE("sha1_commit" SP <oid> LF)
60+
PKT-LINE("committable" SP <integer> LF)
61+
PKT-LINE("workdir_dirty" SP <integer> LF)
62+
63+
64+
V1 Changed Items
65+
----------------
66+
67+
The v1-changed-item-section lists all of the changed items with one
68+
item per pkt-line. Each pkt-line contains: a binary block of data
69+
from "struct wt_status_serialize_data_fixed" in a fixed header where
70+
integers are in network byte order and OIDs are in raw (non-hex) form.
71+
This is followed by one or two raw pathnames (not c-quoted) with NUL
72+
terminators (both NULs are always present even if there is no rename).
73+
74+
v1-changed-item-section = PKT-LINE("changed" SP <count> LF)
75+
[ PKT-LINE(<changed_item> LF) ]+
76+
PKT-LINE(<flush>)
77+
78+
changed_item = <byte[4] worktree_status>
79+
<byte[4] index_status>
80+
<byte[4] stagemask>
81+
<byte[4] score>
82+
<byte[4] mode_head>
83+
<byte[4] mode_index>
84+
<byte[4] mode_worktree>
85+
<byte[4] dirty_submodule>
86+
<byte[4] new_submodule_commits>
87+
<byte[20] oid_head>
88+
<byte[20] oid_index>
89+
<byte[*] path>
90+
NUL
91+
[ <byte[*] src_path> ]
92+
NUL
93+
94+
95+
V1 Untracked and Ignored Items
96+
------------------------------
97+
98+
These sections are simple lists of pathnames. They ARE NOT
99+
c-quoted.
100+
101+
v1-untracked-item-section = PKT-LINE("untracked" SP <count> LF)
102+
[ PKT-LINE(<pathname> LF) ]+
103+
PKT-LINE(<flush>)
104+
105+
v1-ignored-item-section = PKT-LINE("ignored" SP <count> LF)
106+
[ PKT-LINE(<pathname> LF) ]+
107+
PKT-LINE(<flush>)
Collapse file

‎Makefile‎

Copy file name to clipboardExpand all lines: Makefile
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,8 @@ LIB_OBJS += wrapper.o
10741074
LIB_OBJS += write-or-die.o
10751075
LIB_OBJS += ws.o
10761076
LIB_OBJS += wt-status.o
1077+
LIB_OBJS += wt-status-deserialize.o
1078+
LIB_OBJS += wt-status-serialize.o
10771079
LIB_OBJS += xdiff-interface.o
10781080
LIB_OBJS += zlib.o
10791081

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.