Mismatch between "git status" and "git ls-files" [was Re: Teach git status to do "git diff --name-status HEAD"]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
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: stats.sh
Description: application/shellscript


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux