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

Re: git-status too verbose?

From
Shawn Pearce <spearce@spearce.org>
Date
Mar 6, 2006, 17:56 UTC
Message-ID
<20060306175614.GG27965@spearce.org>
In-Reply-To
<87irqrzcs7.wl%cworth@cworth.org>
Carl Worth <cworth@cworth.org> wrote:
Show 36 quoted lines
> On Sat, 4 Mar 2006 12:52:17 -0500, "Eric Jaffe" wrote:
> > I was wondering if anyone else thinks that git-status should be more
> > like "git-diff --name-status". That is,
> >   # A a/newfile.c
> >   # M a/oldfile.c
> 
> Something like that does seem appealing.
> 
> There are at least two issues with doing it:
> 
> 1) It might be tricky coming up with canonical single characters to be
>    used consistently within git. For example, git-ls-files currently
>    does do some single-character state indication, but it can be
>    rather confusing at times. For example:
> 
> 	State		Option	Character
> 	-----		------	---------
> 	Modified	-m	C
> 	Unmerged	-u	M
> 	Cached		-c	H
> 
>    And that looks like a permanent problem. For legacy reasons,
>    I don't think we can change either the options or the output
>    characters of git-ls-files. But perhaps we could at least
>    agree on a single, consistent mapping for all future uses.
> 
> 2) In an important sense, git-status is not verbose enough. For
>    example, given a single line such as the following:
> 
> 	modified: some-file
> 
>    This could indicate at least two different states for some-file:
> 
> 	1) Modified and updated into the index
> 
> 	2) Modified in working tree, but not updated in the index

I've played around with this idea a little bit in pg's pg-status command but I most likely do not have all cases covered.

In general I try to show HEAD<-->index first using uppercase letters then index<-->working directory second in lowercase letters.

Here's the critical portion of pg-status:
	git-diff-index --cached --name-status HEAD | sed -e 's/ / /'
	if test $index_only  = n
	then
	  git-diff-files --name-status | sed \
		-e 's/      / /' \
		-e 's/^D /g /' \
		-e 's/^M /m /' \
		-e '/^U /d'
	  pg--ls-others | sed 's/^/x /'
	fi

Thus far I've found it useful to behave this way and I haven't run up against any states which didn't make immediate sense to me. Here's the documentation I have in pg-status describing what it can show:

Status indicators (displayed in column 1):
 A : New file has been marked for addition with pg-add.
 D : Existing file has been marked as deleted with pg-rm.
 M : Existing file has been modified (and is known to the index).
 U : File still has unmerged hunks, see pg-resolved.
 m : Existing file (maybe) has been modified (use -q to know for sure).
 g : File has been removed from directory but not marked with pg-rm.
 x : File is not known to repository and isn't being ignored.
-- 
Shawn.
Previous: Carl WorthNext: Junio C Hamano
Message 3 of 12 in “git-status too verbose?”
  1. Eric JaffeMar 4, 2006
  2. Carl WorthMar 6, 2006
  3. Shawn PearceMar 6, 2006
  4. Junio C HamanoMar 7, 2006
  5. Joshua N PritikinMar 7, 2006
  6. Karl HasselströmMar 7, 2006
  7. Johannes SchindelinMar 7, 2006
  8. Andreas EricssonMar 7, 2006
  9. Junio C HamanoMar 7, 2006
  10. Andreas EricssonMar 7, 2006
  11. Linus TorvaldsMar 7, 2006
  12. Carl WorthMar 7, 2006

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.