All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Jakub Narebski <jnareb@gmail.com>
Cc: Martin Langhoff <martin@laptop.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Mismatch between "git status" and "git ls-files" [was Re: Teach git status to do "git diff --name-status HEAD"]
Date: Wed, 17 Sep 2008 17:16:16 +0200	[thread overview]
Message-ID: <48D11F40.4000307@drmicha.warpmail.net> (raw)
In-Reply-To: <m3ej3jm3ux.fsf@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

Following up on the discussion about "git status" versus
"youknowwhichscm status" and suggestions to use "git diff --name-status"
or "git ls-files -d -m -o -t" I made a little test case, see the
attached script and output (git version 1.6.0.2.249.g97d7f). Observations:

- "git diff --name-status" and "git ls-files" use very similar form,
even the same status letters, but with completely different meaning for
C, M, R. That is highly confusing (this what I mean by mismatch).

- "git diff --name-status" has no way of showing ignored or untracked files

- "git status" has no way of showing ignored files

- "git ls-files -d -m -o -t" does not distinguish between ignored and
untracked (all is ?)

- "git ls-files" is plumbing, one should not need plumbing to get status
output.

I guess what's needed would be a porcelain that:

- shows state in concise form ("X filename" lines like --name-status or
ls-files -t)
- has options to show ignored and untracked file optionally

To me the most direct approach would be: If "git diff" compares with the
work-tree, teach it to include ignored resp. untracked files optionally.

I guess I wouldn't care about the mismatch then. Are there specific
reasons (other than evolution) for the conflicting status letters?

Michael

[-- Attachment #2: stats.out --]
[-- Type: text/plain, Size: 1559 bytes --]

Initialized empty Git repository in /tmp/mjg/stats/.git/
Created initial commit 345adf7: files to be changed
 10 files changed, 10 insertions(+), 0 deletions(-)
 create mode 100644 copied
 create mode 100644 gitmoved
 create mode 100644 gitremoved
 create mode 100644 modified
 create mode 100644 modifiedadded
 create mode 100644 moved
 create mode 100644 removed
 create mode 100644 typechanged
 create mode 100644 typechangedadded
 create mode 100644 unchanged
rm 'gitremoved'
### git status ###
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   added
#	new file:   copiedadded
#	renamed:    gitmoved -> gitmoved2
#	deleted:    gitremoved
#	modified:   modifiedadded
#	modified:   typechangedadded
#
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#
#	modified:   modified
#	deleted:    moved
#	deleted:    removed
#	modified:   typechanged
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	copiedonly
#	moved2
#	untracked
### git diff ###
M	modified
D	moved
D	removed
M	typechanged
### git diff HEAD ###
A	added
C100	copied	copiedadded
R100	gitmoved	gitmoved2
D	gitremoved
M	modified
M	modifiedadded
D	moved
D	removed
M	typechanged
M	typechangedadded
### git diff --cached HEAD ###
A	added
C100	copied	copiedadded
R100	gitmoved	gitmoved2
D	gitremoved
M	modifiedadded
M	typechangedadded
### git ls-files
? copiedonly
? ignored
? moved2
? untracked
C modified
R moved
C moved
R removed
C removed
C typechanged

[-- Attachment #3: stats.sh --]
[-- Type: application/x-shellscript, Size: 943 bytes --]

  parent reply	other threads:[~2008-09-17 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-17  6:40 Teach git status to do "git diff --name-status HEAD" Martin Langhoff
2008-09-17  8:42 ` Michael J Gruber
2008-09-17 11:04   ` Jakub Narebski
2008-09-17 11:26     ` Michael J Gruber
2008-09-17 15:16     ` Michael J Gruber [this message]
2008-09-17 17:31       ` Mismatch between "git status" and "git ls-files" [was Re: Teach git status to do "git diff --name-status HEAD"] Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D11F40.4000307@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=martin@laptop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.