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

Re: status letters consistency in log and ls-files

From
Jeff King <peff@peff.net>
Date
Sep 27, 2008, 03:30 UTC
Message-ID
<20080927033004.GA2477@coredump.intra.peff.net>
In-Reply-To
<ee2a733e0809262020l318b0ac3v560400d95a5ba2b7@mail.gmail.com>
On Fri, Sep 26, 2008 at 11:20:03PM -0400, Leo Razoumov wrote:
Show 8 quoted lines
> >   git diff --name-status
> >
> >  will show you the modified and deleted files. But since you are using
> >  "-c" to show _all_ cached files, I think only ls-files can do that
> >  (since diff is, obviously, about files with differences).
> 
> Moreover, git diff would not show untracked files while git ls-files
> will include them and label '?'

Yes, but that is somewhat simpler to fix, since we know that they cannot be part of the "git diff" output. That is, you can just append the "git ls-files -v -o" output. Actually, since cached files use the 'H' tag which doesn't conflict with git-diff, and since your goal was to combine the multiple output anyway, I wonder if something like this would make you happy:

  (
    git ls-files --exclude-standard -v -c -o &&
    git diff --name-status --cached
  ) |
  perl -e '
    my %h;
    while(<>) {
      chomp;
      my ($status, $name) = split / /, $_, 2;
      $h{$name} .= $status;
    }
    print "$h{$_} $_\n" foreach sort keys(%h);
  '
?

Personally, I find listing every cached file makes the output hard to read, since any modified ones will be lost in the noise. But that is what you said you wanted...

-Peff
Previous: Leo Razoumov
Message 4 of 4 in “status letters consistency in log and ls-files”
  1. Leo RazoumovSep 26, 2008
  2. Jeff KingSep 26, 2008
  3. Leo RazoumovSep 27, 2008
  4. Jeff KingSep 27, 2008

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.