Re: git-status -- trying to understand all possible states
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 1, 2014, 21:37 UTC
- Message-ID
- <xmqq4n2czq6n.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <4AF06B83-E928-4FE2-8094-F23CE3BA1EBC@toyland.org>
Michael Toy <michael@toyland.org> writes:
> Of the 24 possibilities (not counting ignored) in git-status, > there are 7 that I can't figure out how to generate.
As the post [*1*] that triggered e92e9cd3 (Documentation improvements for the description of short format., 2010-04-23), which is where the bulk of the format description comes from, says, this is "Patches welcome" ;-) Some are just covering possible permutations and it is not surprising if they would not appear in practice.
> D M deleted from index
I doubt this is possible in practice; once you do not have the entry in the index, we do not even look at the working tree file, so it would be unusual to see M in the second column.
> D D unmerged, both deleted > A U unmerged, added by us > U A unmerged, added by them
$ x="100644 $(git hash-object --stdin </dev/null)" &&
printf "$x 2\tbar\n$x 1\tfoo\n$x 3\tbaz" |
git update-index --index-info
$ git status --short -suno
AU bar
UA baz
DD foo
$ git ls-files -u
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 2 bar
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 3 baz
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 1 fooWhen you are using higher-level machinery to merge, "we added, they left it missing" (i.e. bar that has only stage #2) is automatically resolved to an addition by the trivial merge machinery. The "they added, we left it missing" (i.e. baz with only stage #3) case is identical. Also "both of us removed" (i.e. foo that has only stage #1) is resolved to a deletion by the trivial merge machinery. Hence you would not see these three unless you are developing Git using a low-level plumbing machinery.
[Reference]
*1* http://thread.gmane.org/gmane.comp.version-control.git/144455/focus=144468