public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail•com>
To: "Rafael Garcia-Suarez" <rgarciasuarez@gmail•com>
Cc: "Git Mailing List" <git@vger•kernel.org>
Subject: Re: Suggestion: git status --untracked
Date: Mon, 11 Feb 2008 02:56:26 -0800 (PST)	[thread overview]
Message-ID: <m3bq6ng3sb.fsf@localhost.localdomain> (raw)
In-Reply-To: <b77c1dce0802110146o708e26a7lef56683f6b823365@mail.gmail.com>

"Rafael Garcia-Suarez" <rgarciasuarez@gmail•com> writes:

> I find myself wanting sometimes to filter out the output of
> git-status, to feed it to another command (for example, git-add, or
> rm, or cat >> .gitignore). However it's not currently very easy to
> parse in a one-liner.

Probably because git-status is porcelain, and is meant to be used by
end user, not in scripts.
 
> I'm suggesting to add options to control this behaviour. My suggestion
> would be (for a start) to add an option --untracked that will list all
> untracked files on stdout, without a leading "#\t", and without
> listing the added / modified / removed files.
> 
> I'm willing to implement it, but I'd like to have some discussion
> about the interface first. Is that a good idea at all, and how could
> it be improved interface-wise?

To list all untracked files you can use plumbing command, namely
"git ls-files --others" (Show other files in the output), or perhaps
"git ls-files -o --directory --no-empty-directory --exclude-standard"

If you want to use git command in script, it is better to find
appropriate plumbing command to do what you want, for example
git-ls-files instead of git-status to list untracked files,
git-symbolic-ref instead of git-branch to get current branch name,
etc.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

      parent reply	other threads:[~2008-02-11 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-11  9:46 Suggestion: git status --untracked Rafael Garcia-Suarez
2008-02-11 10:13 ` Matthieu Moy
2008-02-11 10:54   ` Rafael Garcia-Suarez
2008-02-11 10:23 ` Jeff King
2008-02-11 10:56 ` Jakub Narebski [this message]

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=m3bq6ng3sb.fsf@localhost.localdomain \
    --to=jnareb@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=rgarciasuarez@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox