Re: [PATCH] Add a -z option to 'git status' to safely feed shell programs with path names
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 17, 2008, 10:14 UTC
- Message-ID
- <alpine.DEB.1.00.0805171109000.30431@racer>
- In-Reply-To
- <20080517025133.GQ29038@spearce.org>
Hi,
On Fri, 16 May 2008, Shawn O. Pearce wrote:
Show 8 quoted lines
> Sebastien Gross <seb-git@chezwam.org> wrote: > > Add a -z option to 'git status' to get a list of all files > > but ignored, starting with modification type or 'untracked' > > as prefix and ending with '\0'. > > Hmm. Is the plumbing really that broken that you need to add -z support > to porcelain rather than using the -z support already built into the > plumbing?
To answer the retorical question: no, it is not. git ls-files already has the "-z" flag, and we even have the scripts in contrib/examples/ to prove that it works very fine, thankyouverymuch.
Just as an example: this ugly, long line
git status -z | gawk 'BEGIN{RS="\0"; ORS="\0";}/^untracked/ \
{sub("^.+:", "");print}' | xargs -0 -r rmcould be expressed like this:
git ls-files --others -z | xargs -0 -r rm
I believe. If not, this should provide a good starting point, without changing Git at all!
> A very large and intrusive looking patch for what can already be > obtained easier through existing, stable porcelain. Not something I am > in favor of seeing added at this time.
It is not only intrusive looking. It is sneaky: it changes git-commit at the same time, even if you would not begin to guess from the shortline.
It adds a function that is clearly path-related into quote.c!
And then, the commit message is quite different from the other commit messages in git.git, no?
Opposed to the patch, Dscho