Skip to content

Commit d05bb8a

Browse files
jeffhostetlerdscho
authored andcommitted
git-status.txt: describe --porcelain=v2 format
Update status manpage to include information about porcelain v2 format. Signed-off-by: Jeff Hostetler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8c0cff9 commit d05bb8a

File tree

1 file changed

+122
-4
lines changed

1 file changed

+122
-4
lines changed

Documentation/git-status.txt

Lines changed: 122 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ in which case `XY` are `!!`.
183183

184184
If -b is used the short-format status is preceded by a line
185185

186-
## branchname tracking info
186+
## branchname tracking info
187187

188-
Porcelain Format
189-
~~~~~~~~~~~~~~~~
188+
Porcelain Format Version 1
189+
~~~~~~~~~~~~~~~~~~~~~~~~~~
190190

191-
The porcelain format is similar to the short format, but is guaranteed
191+
Version 1 porcelain format is similar to the short format, but is guaranteed
192192
not to change in a backwards-incompatible way between Git versions or
193193
based on user configuration. This makes it ideal for parsing by scripts.
194194
The description of the short format above also describes the porcelain
@@ -210,6 +210,124 @@ field from the first filename). Third, filenames containing special
210210
characters are not specially formatted; no quoting or
211211
backslash-escaping is performed.
212212

213+
Porcelain Format Version 2
214+
~~~~~~~~~~~~~~~~~~~~~~~~~~
215+
216+
Version 2 format adds more detailed information about the state of
217+
the worktree and changed items. Version 2 also defines an extensible
218+
set of easy to parse optional headers.
219+
220+
Header lines start with "#" and are added in response to specific
221+
command line arguments. Parsers should ignore headers they
222+
don't recognize.
223+
224+
### Branch Headers
225+
226+
If `--branch` is given, a series of header lines are printed with
227+
information about the current branch.
228+
229+
Line Notes
230+
------------------------------------------------------------
231+
# branch.oid <commit> | (initial) Current commit.
232+
# branch.head <branch> | (detached) Current branch.
233+
# branch.upstream <upstream_branch> If upstream is set.
234+
# branch.ab +<ahead> -<behind> If upstream is set and
235+
the commit is present.
236+
------------------------------------------------------------
237+
238+
### Changed Tracked Entries
239+
240+
Following the headers, a series of lines are printed for tracked
241+
entries. One of three different line formats may be used to describe
242+
an entry depending on the type of change. Tracked entries are printed
243+
in an undefined order; parsers should allow for a mixture of the 3
244+
line types in any order.
245+
246+
Ordinary changed entries have the following format:
247+
248+
1 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <path>
249+
250+
Renamed or copied entries have the following format:
251+
252+
2 <XY> <sub> <mH> <mI> <mW> <hH> <hI> <X><score> <path><sep><origPath>
253+
254+
Field Meaning
255+
--------------------------------------------------------
256+
<XY> A 2 character field containing the staged and
257+
unstaged XY values described in the short format,
258+
with unchanged indicated by a "." rather than
259+
a space.
260+
<sub> A 4 character field describing the submodule state.
261+
"N..." when the entry is not a submodule.
262+
"S<c><m><u>" when the entry is a submodule.
263+
<c> is "C" if the commit changed; otherwise ".".
264+
<m> is "M" if it has tracked changes; otherwise ".".
265+
<u> is "U" if there are untracked changes; otherwise ".".
266+
<mH> The octal file mode in HEAD.
267+
<mI> The octal file mode in the index.
268+
<mW> The octal file mode in the worktree.
269+
<hH> The object name in HEAD.
270+
<hI> The object name in the index.
271+
<X><score> The rename or copy score (denoting the percentage
272+
of similarity between the source and target of the
273+
move or copy). For example "R100" or "C75".
274+
<path> The pathname. In a renamed/copied entry, this
275+
is the path in the index and in the working tree.
276+
<sep> When the `-z` option is used, the 2 pathnames are separated
277+
with a NUL (ASCII 0x00) byte; otherwise, a tab (ASCII 0x09)
278+
byte separates them.
279+
<origPath> The pathname in the commit at HEAD. This is only
280+
present in a renamed/copied entry, and tells
281+
where the renamed/copied contents came from.
282+
--------------------------------------------------------
283+
284+
Unmerged entries have the following format; the first character is
285+
a "u" to distinguish from ordinary changed entries.
286+
287+
u <xy> <sub> <m1> <m2> <m3> <mW> <h1> <h2> <h3> <path>
288+
289+
Field Meaning
290+
--------------------------------------------------------
291+
<XY> A 2 character field describing the conflict type
292+
as described in the short format.
293+
<sub> A 4 character field describing the submodule state
294+
as described above.
295+
<m1> The octal file mode in stage 1.
296+
<m2> The octal file mode in stage 2.
297+
<m3> The octal file mode in stage 3.
298+
<mW> The octal file mode in the worktree.
299+
<h1> The object name in stage 1.
300+
<h2> The object name in stage 2.
301+
<h3> The object name in stage 3.
302+
<path> The pathname.
303+
--------------------------------------------------------
304+
305+
### Other Items
306+
307+
Following the tracked entries (and if requested), a series of
308+
lines will be printed for untracked and then ignored items
309+
found in the worktree.
310+
311+
Untracked items have the following format:
312+
313+
? <path>
314+
315+
Ignored items have the following format:
316+
317+
! <path>
318+
319+
### Pathname Format Notes and -z
320+
321+
When the `-z` option is given, pathnames are printed as is and
322+
without any quoting and lines are terminated with a NUL (ASCII 0x00)
323+
byte.
324+
325+
Otherwise, all pathnames will be "C-quoted" if they contain any tab,
326+
linefeed, double quote, or backslash characters. In C-quoting, these
327+
characters will be replaced with the corresponding C-style escape
328+
sequences and the resulting pathname will be double quoted.
329+
330+
213331
CONFIGURATION
214332
-------------
215333

0 commit comments

Comments
 (0)