# status letters consistency in log and ls-files

4 messages from 2008-09-26 to 2008-09-27. Participants: Leo Razoumov, Jeff King.
Thread: https://gitlist.dev/t/15685

## Leo Razoumov, 2008-09-26 18:28

Subject: status letters consistency in log and ls-files
Message-ID: <ee2a733e0809261128h4c50d27bq3942bd1b3b66d3ee@mail.gmail.com>
URL: https://gitlist.dev/e/ee2a733e0809261128h4c50d27bq3942bd1b3b66d3ee%40mail.gmail.com

```
Hi Everyone,
I am new yo git and there are few things I find quite odd. For example,

command "git log --name-status" uses the following letters to indicate
file's status
A  -- Added
B  -- have had their pairing Broken
C  -- Copied
D  -- Deleted
M  -- Modified
R  -- Renamed
T  -- Type changed (mode, time stamp)
U  -- Unmerged
X  -- Unknown

At the same time command "git ls-files -v" use different letters to
indicate the same
H  --  cached
M  -- unmerged
R  -- removed/deleted
C  -- modified/changed
K  -- to be killed
?  -- other

So, depending on which of the commands above are used status "R" could
mean either Renamed or Removed, "M" is either Modified or unMerged,
"C" is either Copied or Changed.

Is it possible to make it consistent across related commands?

--Leo--

```

## Jeff King, 2008-09-26 22:45

Subject: Re: status letters consistency in log and ls-files
Message-ID: <20080926224546.GB24817@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20080926224546.GB24817%40coredump.intra.peff.net
In-Reply-To: <ee2a733e0809261128h4c50d27bq3942bd1b3b66d3ee@mail.gmail.com>

```
On Fri, Sep 26, 2008 at 02:28:50PM -0400, Leo Razoumov wrote:

> So, depending on which of the commands above are used status "R" could
> mean either Renamed or Removed, "M" is either Modified or unMerged,
> "C" is either Copied or Changed.
> 
> Is it possible to make it consistent across related commands?

I think this is rooted in historical reasons. Unfortunately, I don't
think it is possible to reconcile the two outputs at this point, as we
would be breaking any scripts which use the tools.

Out of curiosity, is there a script you are writing or some workflow you
have where you see the output of both? Or did you just notice this while
exploring git?

I ask because there may be a way to alter your workflow to always use
one tool.

-Peff

```

## Leo Razoumov, 2008-09-27 03:20

Subject: Re: status letters consistency in log and ls-files
Message-ID: <ee2a733e0809262020l318b0ac3v560400d95a5ba2b7@mail.gmail.com>
URL: https://gitlist.dev/e/ee2a733e0809262020l318b0ac3v560400d95a5ba2b7%40mail.gmail.com
In-Reply-To: <20080927002949.GA25586@coredump.intra.peff.net>

```
On 9/26/08, Jeff King <peff@peff.net> wrote:
> On Fri, Sep 26, 2008 at 07:24:11PM -0400, Leo Razoumov wrote:
>
>  > Another script takes output of
>  >   git ls-files -v -c -d -m -o -k
>  > and for each file pulls together all the file status letters in one record.
>
>
> OK. I was thinking I could suggest just using "git diff" here instead.
>  E.g.,:
>
>   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).
>
>  So I'm not sure there is a straight-forward solution short of
>  translating the status codes.
>
>  -Peff

Moreover, git diff would not show untracked files while git ls-files
will include them and label '?'

--Leo--

```

## Jeff King, 2008-09-27 03:30

Subject: Re: status letters consistency in log and ls-files
Message-ID: <20080927033004.GA2477@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20080927033004.GA2477%40coredump.intra.peff.net
In-Reply-To: <ee2a733e0809262020l318b0ac3v560400d95a5ba2b7@mail.gmail.com>

```
On Fri, Sep 26, 2008 at 11:20:03PM -0400, Leo Razoumov wrote:

> >   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

```
