{"thread":{"id":"36336","subject":"git-status -- trying to understand all possible states","startedAt":"2014-04-01T20:07:33Z","lastAt":"2014-04-02T08:31:45Z","messageCount":5,"participants":["Michael Toy","Junio C Hamano","Jonathan Nieder","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"238265","messageId":"4AF06B83-E928-4FE2-8094-F23CE3BA1EBC@toyland.org","threadId":"36336","inReplyTo":null,"subject":"git-status -- trying to understand all possible states","fromName":"Michael Toy","fromEmail":"michael@toyland.org","sentAt":"2014-04-01T20:07:33Z","receivedAt":"2014-04-01T20:07:33Z","isPatch":false,"sender":{"key":"michael@toyland.org","avatar":null},"body":"I also have this question posted to stack overflow ( http://stackoverflow.com/questions/22792906/how-do-i-produce-every-possible-git-status ), but perhaps this is a better place to ask this question.\n\nIn working on some code which provides an interface to existing git repositories the question I had was \"what actions should I present to a user\", which lead to the question, \"what does a user need to do to generate that condition\", which lead to developing this gist:\n\nhttps://gist.github.com/the-michael-toy/9907309\n\n... which is a ruby script which tries to produce a repository with a file in every possible \"git-status\" XY condition\n\nOf the 24 possibilities (not counting ignored) in git-status, there are 7 that I can't figure out how to generate.\n\nD           M    deleted from index\nC        [ MD]   copied in index\nD           D    unmerged, both deleted\nA           U    unmerged, added by us\nU           A    unmerged, added by them\n\nany clues, including pointers to \"just go read XXX\" would be appreciated.\n"},{"id":"238275","messageId":"xmqq4n2czq6n.fsf@gitster.dls.corp.google.com","threadId":"36336","inReplyTo":"4AF06B83-E928-4FE2-8094-F23CE3BA1EBC@toyland.org","subject":"Re: git-status -- trying to understand all possible states","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-04-01T21:37:52Z","receivedAt":"2014-04-01T21:37:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Toy <michael@toyland.org> writes:\n\n> Of the 24 possibilities (not counting ignored) in git-status,\n> there are 7 that I can't figure out how to generate.\n\nAs the post [*1*] that triggered e92e9cd3 (Documentation\nimprovements for the description of short format., 2010-04-23),\nwhich is where the bulk of the format description comes from, says,\nthis is \"Patches welcome\" ;-) Some are just covering possible\npermutations and it is not surprising if they would not appear in\npractice.\n\n> D           M    deleted from index\n\nI doubt this is possible in practice; once you do not have the entry\nin the index, we do not even look at the working tree file, so it\nwould be unusual to see M in the second column.\n\n> D           D    unmerged, both deleted\n> A           U    unmerged, added by us\n> U           A    unmerged, added by them\n\n    $ x=\"100644 $(git hash-object --stdin </dev/null)\" &&\n      printf \"$x 2\\tbar\\n$x 1\\tfoo\\n$x 3\\tbaz\" |\n      git update-index --index-info\n    $ git status --short -suno\n    AU bar\n    UA baz\n    DD foo\n    $ git ls-files -u\n    100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 2       bar\n    100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 3       baz\n    100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 1       foo\n\nWhen you are using higher-level machinery to merge, \"we added, they\nleft it missing\" (i.e. bar that has only stage #2) is automatically\nresolved to an addition by the trivial merge machinery.  The \"they\nadded, we left it missing\" (i.e. baz with only stage #3) case is\nidentical.  Also \"both of us removed\" (i.e. foo that has only stage\n#1) is resolved to a deletion by the trivial merge machinery.  Hence\nyou would not see these three unless you are developing Git using a\nlow-level plumbing machinery.\n\n[Reference]\n\n*1* http://thread.gmane.org/gmane.comp.version-control.git/144455/focus=144468\n"},{"id":"238279","messageId":"20140401222002.GD6851@google.com","threadId":"36336","inReplyTo":"4AF06B83-E928-4FE2-8094-F23CE3BA1EBC@toyland.org","subject":"Re: git-status -- trying to understand all possible states","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-04-01T22:20:02Z","receivedAt":"2014-04-01T22:20:02Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Michael Toy wrote:\n\n> https://gist.github.com/the-michael-toy/9907309\n\nTwo nits:\n\n - Please use --porcelain (implied by -z in the absence of another\n   format option) instead of --short.  --short is meant to be human\n   readable and details of the output might change some day.\n\n - Depending on what you're trying to do, you might find the output\n   from other commands such as \"git ls-files -s\" or \"git diff-files\"\n   easier to work with.\n\nHope that helps,\nJonathan\n"},{"id":"238282","messageId":"1DC6FC8F-3CF8-4DDF-8B34-9349E8289C47@toyland.org","threadId":"36336","inReplyTo":"xmqq4n2czq6n.fsf@gitster.dls.corp.google.com","subject":"Re: git-status -- trying to understand all possible states","fromName":"Michael Toy","fromEmail":"michael@toyland.org","sentAt":"2014-04-01T23:01:21Z","receivedAt":"2014-04-01T23:01:21Z","isPatch":false,"sender":{"key":"michael@toyland.org","avatar":null},"body":"On Apr 1, 2014, at 2:37 PM, Junio C Hamano <gitster@pobox.com> wrote:\n\n>> D           M    deleted from index\n> \n> I doubt this is possible in practice ...\n> \n>> D           D    unmerged, both deleted\n>> A           U    unmerged, added by us\n>> U           A    unmerged, added by them\n> \n>   ... you would not see these three unless you are developing Git using a\n> low-level plumbing machinery.\n\nThanks, that is very helpful.\n\nThe \"C[ MD]\" are now the remaining mystery\n"},{"id":"238315","messageId":"vpqd2h0gmj2.fsf@anie.imag.fr","threadId":"36336","inReplyTo":"20140401222002.GD6851@google.com","subject":"Re: git-status -- trying to understand all possible states","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2014-04-02T08:31:45Z","receivedAt":"2014-04-02T08:31:45Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>  - Please use --porcelain (implied by -z in the absence of another\n>    format option) instead of --short.  --short is meant to be human\n>    readable and details of the output might change some day.\n\nIt already does: part of the output may be translated to non-english.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}