{"thread":{"id":"15685","subject":"status letters consistency in log and ls-files","startedAt":"2008-09-26T18:28:50Z","lastAt":"2008-09-27T03:30:05Z","messageCount":4,"participants":["Leo Razoumov","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"91711","messageId":"ee2a733e0809261128h4c50d27bq3942bd1b3b66d3ee@mail.gmail.com","threadId":"15685","inReplyTo":null,"subject":"status letters consistency in log and ls-files","fromName":"Leo Razoumov","fromEmail":"slonik.az@gmail.com","sentAt":"2008-09-26T18:28:50Z","receivedAt":"2008-09-26T18:28:50Z","isPatch":false,"sender":{"key":"slonik.az@gmail.com","avatar":null},"body":"Hi Everyone,\nI am new yo git and there are few things I find quite odd. For example,\n\ncommand \"git log --name-status\" uses the following letters to indicate\nfile's status\nA  -- Added\nB  -- have had their pairing Broken\nC  -- Copied\nD  -- Deleted\nM  -- Modified\nR  -- Renamed\nT  -- Type changed (mode, time stamp)\nU  -- Unmerged\nX  -- Unknown\n\nAt the same time command \"git ls-files -v\" use different letters to\nindicate the same\nH  --  cached\nM  -- unmerged\nR  -- removed/deleted\nC  -- modified/changed\nK  -- to be killed\n?  -- other\n\nSo, depending on which of the commands above are used status \"R\" could\nmean either Renamed or Removed, \"M\" is either Modified or unMerged,\n\"C\" is either Copied or Changed.\n\nIs it possible to make it consistent across related commands?\n\n--Leo--\n"},{"id":"91717","messageId":"20080926224546.GB24817@coredump.intra.peff.net","threadId":"15685","inReplyTo":"ee2a733e0809261128h4c50d27bq3942bd1b3b66d3ee@mail.gmail.com","subject":"Re: status letters consistency in log and ls-files","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-26T22:45:46Z","receivedAt":"2008-09-26T22:45:46Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Sep 26, 2008 at 02:28:50PM -0400, Leo Razoumov wrote:\n\n> So, depending on which of the commands above are used status \"R\" could\n> mean either Renamed or Removed, \"M\" is either Modified or unMerged,\n> \"C\" is either Copied or Changed.\n> \n> Is it possible to make it consistent across related commands?\n\nI think this is rooted in historical reasons. Unfortunately, I don't\nthink it is possible to reconcile the two outputs at this point, as we\nwould be breaking any scripts which use the tools.\n\nOut of curiosity, is there a script you are writing or some workflow you\nhave where you see the output of both? Or did you just notice this while\nexploring git?\n\nI ask because there may be a way to alter your workflow to always use\none tool.\n\n-Peff\n"},{"id":"91728","messageId":"ee2a733e0809262020l318b0ac3v560400d95a5ba2b7@mail.gmail.com","threadId":"15685","inReplyTo":"20080927002949.GA25586@coredump.intra.peff.net","subject":"Re: status letters consistency in log and ls-files","fromName":"Leo Razoumov","fromEmail":"slonik.az@gmail.com","sentAt":"2008-09-27T03:20:03Z","receivedAt":"2008-09-27T03:20:03Z","isPatch":false,"sender":{"key":"slonik.az@gmail.com","avatar":null},"body":"On 9/26/08, Jeff King <peff@peff.net> wrote:\n> On Fri, Sep 26, 2008 at 07:24:11PM -0400, Leo Razoumov wrote:\n>\n>  > Another script takes output of\n>  >   git ls-files -v -c -d -m -o -k\n>  > and for each file pulls together all the file status letters in one record.\n>\n>\n> OK. I was thinking I could suggest just using \"git diff\" here instead.\n>  E.g.,:\n>\n>   git diff --name-status\n>\n>  will show you the modified and deleted files. But since you are using\n>  \"-c\" to show _all_ cached files, I think only ls-files can do that\n>  (since diff is, obviously, about files with differences).\n>\n>  So I'm not sure there is a straight-forward solution short of\n>  translating the status codes.\n>\n>  -Peff\n\nMoreover, git diff would not show untracked files while git ls-files\nwill include them and label '?'\n\n--Leo--\n"},{"id":"91729","messageId":"20080927033004.GA2477@coredump.intra.peff.net","threadId":"15685","inReplyTo":"ee2a733e0809262020l318b0ac3v560400d95a5ba2b7@mail.gmail.com","subject":"Re: status letters consistency in log and ls-files","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-27T03:30:05Z","receivedAt":"2008-09-27T03:30:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Sep 26, 2008 at 11:20:03PM -0400, Leo Razoumov wrote:\n\n> >   git diff --name-status\n> >\n> >  will show you the modified and deleted files. But since you are using\n> >  \"-c\" to show _all_ cached files, I think only ls-files can do that\n> >  (since diff is, obviously, about files with differences).\n> \n> Moreover, git diff would not show untracked files while git ls-files\n> will include them and label '?'\n\nYes, but that is somewhat simpler to fix, since we know that they cannot\nbe part of the \"git diff\" output. That is, you can just append the \"git\nls-files -v -o\" output. Actually, since cached files use the 'H' tag\nwhich doesn't conflict with git-diff, and since your goal was to combine\nthe multiple output anyway, I wonder if something like this would make\nyou happy:\n\n  (\n    git ls-files --exclude-standard -v -c -o &&\n    git diff --name-status --cached\n  ) |\n  perl -e '\n    my %h;\n    while(<>) {\n      chomp;\n      my ($status, $name) = split / /, $_, 2;\n      $h{$name} .= $status;\n    }\n    print \"$h{$_} $_\\n\" foreach sort keys(%h);\n  '\n\n?\n\nPersonally, I find listing every cached file makes the output hard to\nread, since any modified ones will be lost in the noise. But that is\nwhat you said you wanted...\n\n-Peff\n"}]}