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

Re: git working tree status

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Oct 26, 2008, 22:23 UTC
Message-ID
<20081026222335.GJ2273@genesis.frugalware.org>
In-Reply-To
<73f525b90810261454wb902edfk3a696c06ef2148d1@mail.gmail.com>
On Sun, Oct 26, 2008 at 09:54:03PM +0000, Mike Clarke <clarkema@gmail.com> wrote:
> a) fully 'clean' -- i.e., all changes checked in, no stashes;
In case you want to ignore ignores:
$ git ls-files -o
otherwise:
git ls-files -o --exclude-standard

by 'stashes', I guess you mean those extra files, but using that term is confusing, given that stashes can be listed with git stash list and they are actually merge commits (so something totally different).

> b) all changes checked in, but there are some stashes; or

git update-index -q --refresh test -z "$(git diff-index --name-only HEAD --)" && echo "everything committed"

> c) 'dirty' in some way -- new files, uncommitted changes, etc.

git update-index -q --refresh test -z "$(git diff-index --name-only HEAD --)" && echo "dirty"

see GIT-VERSION-GEN in git.git
> 1) Is there already some way of doing this that I've overlooked?
> 2) Would the preferred approach be an option (git status --is-clean)
> or a sub-command (git is-clean)?  A sub-command would probably result
> in cleaner internal code, but would also clutter the interface.

I guess you overlooked the fact that plumbing is supposed to be used from scripts and porcelain by the users. git status is porcelain, so in general just don't use it from scripts.

> 3) Is a patch for such a feature likely to be accepted?
I don't think so, see above.
Previous: Mike ClarkeNext: Miklos Vajna
Message 2 of 4 in “git working tree status”
  1. Mike ClarkeOct 26, 2008
  2. Miklos VajnaOct 26, 2008
  3. Miklos VajnaOct 26, 2008
  4. Mike ClarkeOct 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.