Re: [PATCH] docs: add description of status output table

4 messages, 3 authors, 2021-01-10 · open the first message on its own page

Re: [PATCH] docs: add description of status output table

From: Junio C Hamano <hidden>
Date: 2021-01-10 01:42:26

"brian m. carlson" [off-list ref] writes:
The table describing the porcelain format in git-status(1) is helpful,
but it's not completely clear what the three sections mean, even to
some contributors.  As a result, users are unable to find how to detect
common cases like merge conflicts programmatically.
I agree that the addition clarifies, but it is a bit sad that we
already have a beginning of the explanation; I wonder if we should
improve the existing description in addition, even if it may not be
sufficient to eliminate the need for this new paragraph.  Here is
what we already have:

    For paths with merge conflicts, `X` and `Y` show the modification
    states of each side of the merge. For paths that do not have merge
    conflicts, `X` shows the status of the index, and `Y` shows the status
    of the work tree.  For untracked paths, `XY` are `??`.  Other status
    codes can be interpreted as follows:

This introductory text does sort-of hint that there are three
classes (merged paths, unmerged paths and untracked paths), but (1)
the order the three classes are described do not match that of the
table, and (2) the explanation of the untracked paths predates the
addition of ignored ones to the untracked class, so the description
is added after the legends as if an afterthought.

I am actually tempted to suggest rewriting the whole section,
starting from the paragraph above and ending at the table, with
something like this:

    Three different classes of paths are shown in the same format,
    but the meaning of `XY` are different:

    * For merged paths, `X` shows the status of the index, and `Y`
      shows the status of the working tree.

    * For unmerged paths, `X` and `Y` show the modification states
      of each side of the merge, relative to the common ancestor.

    * For untracked paths, `X` and `Y` do not convey different
      meaning (as, by definition, they are not known to the index);
      `??` is shown for untracked paths, and when `--ignored` option
      is in effect, ignored paths are shown with `!!`.

    In the following table, these three classes are shown in
    separate sections, and these characters are used for `X` and `Y`
    fields for the first two sections that show tracked paths:

    * ' ' = unmodified
    * 'M' = modified

       ...

    ....
    X        Y       Meaning
    ------------------------------------------------------------
            [AMD]    not updated

       ...

Hmm?

Re: [PATCH] docs: add description of status output table

From: brian m. carlson <hidden>
Date: 2021-01-10 01:59:03

On 2021-01-10 at 01:41:23, Junio C Hamano wrote:
"brian m. carlson" [off-list ref] writes:
quoted
The table describing the porcelain format in git-status(1) is helpful,
but it's not completely clear what the three sections mean, even to
some contributors.  As a result, users are unable to find how to detect
common cases like merge conflicts programmatically.
I agree that the addition clarifies, but it is a bit sad that we
already have a beginning of the explanation; I wonder if we should
improve the existing description in addition, even if it may not be
sufficient to eliminate the need for this new paragraph.  Here is
what we already have:

    For paths with merge conflicts, `X` and `Y` show the modification
    states of each side of the merge. For paths that do not have merge
    conflicts, `X` shows the status of the index, and `Y` shows the status
    of the work tree.  For untracked paths, `XY` are `??`.  Other status
    codes can be interpreted as follows:

This introductory text does sort-of hint that there are three
classes (merged paths, unmerged paths and untracked paths), but (1)
the order the three classes are described do not match that of the
table, and (2) the explanation of the untracked paths predates the
addition of ignored ones to the untracked class, so the description
is added after the legends as if an afterthought.

I am actually tempted to suggest rewriting the whole section,
starting from the paragraph above and ending at the table, with
something like this:
Sure, I can reroll with that.  I noticed that we're using a text diagram
instead of a table, so maybe I can fix that up as well in v2, depending
how the output looks.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US

Re: [PATCH] docs: add description of status output table

From: Alan Mackenzie <hidden>
Date: 2021-01-10 12:29:23

Hello, Junio and Brian.

Thanks for such rapid and helpful responses to my post.

On Sat, Jan 09, 2021 at 17:41:23 -0800, Junio C Hamano wrote:
"brian m. carlson" [off-list ref] writes:
quoted
The table describing the porcelain format in git-status(1) is helpful,
but it's not completely clear what the three sections mean, even to
some contributors.  As a result, users are unable to find how to detect
common cases like merge conflicts programmatically.
I agree that the addition clarifies, but it is a bit sad that we
already have a beginning of the explanation; I wonder if we should
improve the existing description in addition, even if it may not be
sufficient to eliminate the need for this new paragraph.  Here is
what we already have:
    For paths with merge conflicts, `X` and `Y` show the modification
    states of each side of the merge. For paths that do not have merge
    conflicts, `X` shows the status of the index, and `Y` shows the status
    of the work tree.  For untracked paths, `XY` are `??`.  Other status
    codes can be interpreted as follows:
Another problem I tripped over was that word "Other", which is
ambiguous.  For quite some time I read it wrongly as meaning "Other than
the codes already described in this paragraph" rather than its intended
meaning "Other than for untracked paths".  So I was searching through
the man page looking for a description of codes for conflicts.
This introductory text does sort-of hint that there are three
classes (merged paths, unmerged paths and untracked paths), but (1)
the order the three classes are described do not match that of the
table, and (2) the explanation of the untracked paths predates the
addition of ignored ones to the untracked class, so the description
is added after the legends as if an afterthought.
When you amend this documentation, would you please consider using the
term "conflicts" instead of, or as well as "unmerged".  "Conflicts" is
something definite and clear - "unmerged" feels a bit vague and
indefinite, to me at any rate.  Why might a file be "unmerged" still?
I am actually tempted to suggest rewriting the whole section,
starting from the paragraph above and ending at the table, with
something like this:
    Three different classes of paths are shown in the same format,
    but the meaning of `XY` are different:
    * For merged paths, `X` shows the status of the index, and `Y`
      shows the status of the working tree.
    * For unmerged paths, `X` and `Y` show the modification states
      of each side of the merge, relative to the common ancestor.
Also missing from the current doc, I think, is a description of which
"side" of the difference is represented by X, and which by Y.  In my use
case (having conflicts after doing a git stash pop) those "sides" would
be the work tree and the repository.  In other scenarios (say a merge
conflict after git pull) I think they would be something else (though my
head is hurting a bit, here).
    * For untracked paths, `X` and `Y` do not convey different
      meaning (as, by definition, they are not known to the index);
      `??` is shown for untracked paths, and when `--ignored` option
      is in effect, ignored paths are shown with `!!`.
    In the following table, these three classes are shown in
    separate sections, and these characters are used for `X` and `Y`
    fields for the first two sections that show tracked paths:
    * ' ' = unmodified
    * 'M' = modified
       ...
    ....
    X        Y       Meaning
    ------------------------------------------------------------
            [AMD]    not updated
       ...
Hmm?
I would appreciate such a new formulation.  Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).

Re: [PATCH] docs: add description of status output table

From: brian m. carlson <hidden>
Date: 2021-01-10 18:34:03

On 2021-01-10 at 12:28:40, Alan Mackenzie wrote:
On Sat, Jan 09, 2021 at 17:41:23 -0800, Junio C Hamano wrote:
quoted
I am actually tempted to suggest rewriting the whole section,
starting from the paragraph above and ending at the table, with
something like this:
quoted
    Three different classes of paths are shown in the same format,
    but the meaning of `XY` are different:
quoted
    * For merged paths, `X` shows the status of the index, and `Y`
      shows the status of the working tree.
quoted
    * For unmerged paths, `X` and `Y` show the modification states
      of each side of the merge, relative to the common ancestor.
Also missing from the current doc, I think, is a description of which
"side" of the difference is represented by X, and which by Y.  In my use
case (having conflicts after doing a git stash pop) those "sides" would
be the work tree and the repository.  In other scenarios (say a merge
conflict after git pull) I think they would be something else (though my
head is hurting a bit, here).
The two sides are the two heads that are being merged and don't include
the working tree at all.  I think the answer about which side is which
in a merge depends on whether you're merging or rebasing.  Rebases do
things the opposite way of how merges do them.

In your case, you're interested in the fact that there _is_ an
unresolved conflict, which means you'll either get DD, AA, or something
with a U in it.  That will happen regardless of how you do it, with git
pull, git merge, git rebase -m, or git cherry-pick, and it indicates
that the working tree is "broken" (i.e., has conflict markers) and the
index is in a conflicted state.  Since the state of the working tree and
the index are known, we use this field for listing the two heads
instead.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help