git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Efficient parsing of `status -z` output

From
Jeff King <peff@peff.net>
Date
Mar 10, 2015, 05:41 UTC
Message-ID
<20150310054146.GA3216@peff.net>
In-Reply-To
<CAMJduDvuBF6KwLjmnxmMgfeSYfO6uDVfnkF=VTLTr8t8qowb0w@mail.gmail.com>
On Mon, Mar 09, 2015 at 07:40:43PM -0400, Matthew Rothenberg wrote:
Show 17 quoted lines
> On Mon, Mar 9, 2015 at 2:49 AM, Jeff King <peff@peff.net> wrote:
> >   $ git init
> >   $ seq 1 1000 >file && git add file && git commit -m base
> >   $ mv file other
> >   $ echo foo >file
> >   $ git add .
> >   $ git status --short
> >   M  file
> >   C  file -> other
> 
> Fantastic, I am able to replicate with these steps and will build
> tests around this case.
> 
> For future proofing, from the documentation for git status is appears
> the other two codes I would want to check for in addition to 'C '
> (which this test cases generates) may be 'CM' and 'CD'? And all of
> those should always have the additional PATH2 column present?

Yes, you can trivially make CM and CD by changing or deleting "other" in the example above. I don't think you can ever have 'C' or 'R' in the second column; we don't do renames on working tree changes, since a "new" file there is simply untracked.

-Peff
Previous: Matthew Rothenberg
Message 7 of 7 in “Efficient parsing of `status -z` output”
  1. Matthew RothenbergMar 7, 2015
  2. Junio C HamanoMar 8, 2015
  3. Matthew RothenbergMar 9, 2015
  4. Jeff KingMar 9, 2015
  5. Jeff KingMar 9, 2015
  6. Matthew RothenbergMar 9, 2015
  7. Jeff KingMar 10, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.