git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: jaseem abid <jaseemabid@gmail.com>
Cc: Marcus Karlsson <mk@acc.umu.se>, git mailing list <git@vger.kernel.org>
Subject: Re: Arguments to git hooks
Date: Mon, 7 May 2012 03:21:23 -0400	[thread overview]
Message-ID: <20120507072123.GB19874@sigill.intra.peff.net> (raw)
In-Reply-To: <CAH-tXsDe7Hsacz19egdeW2sDV3SoPkJpJLPAmk_pCoEiR3wvcQ@mail.gmail.com>

On Mon, May 07, 2012 at 03:10:07AM +0530, jaseem abid wrote:

> On Mon, May 7, 2012 at 2:41 AM, Marcus Karlsson <mk@acc.umu.se> wrote:
> > There are many different reasons to use hooks. If everything that a hook
> > could potentially need was passed to it as an argument then a lot of
> > data would often end up unused. Better to supply as little as possible
> > and only do more work when it's actually needed.
> 
> That seems like a good reason not to pass all of the data, but isn't
> the file names the most primary thing somebody can ask for?

Yes, although keep in mind that the list of files does not necessarily
fit onto the command line. We would have to feed it over stdin, and then
you would have parsing/quoting issues.

But you can get the exact same list from "git diff-index --cached
--name-only", and it is exactly as hard to parse as stdin would be (and
you can even decide to use "-z" to eliminate the quoting issues).

So asking the user to call the plumbing command is more efficient and
more flexible, but not actually any harder to use.

> > I wouldn't go as deep as the plumbing, I think git status --porcelain
> > should work just fine, the output is fairly easy to parse.
> 
> I have always wondered why 'git status --porcelain' is giving a
> 'plumbing' style output. Any docs on this somewhere?

It is plumbing. The porcelain is meant to be "output suitable for
reading by porcelains". Although I was the person who named "git status
--porcelain", it is not a convention I think is particularly good; I
named it to be consistent with other git commands which have a
"--porcelain" mode.

-Peff

  reply	other threads:[~2012-05-07  7:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-06 18:35 Arguments to git hooks jaseem abid
2012-05-06 19:12 ` Marcus Karlsson
2012-05-06 19:18   ` jaseem abid
2012-05-06 21:11     ` Marcus Karlsson
2012-05-06 21:40       ` jaseem abid
2012-05-07  7:21         ` Jeff King [this message]
2012-05-07  7:15 ` Jeff King
2012-05-07 22:17 ` Andrew Sayers
2012-05-14 20:34   ` jaseem abid

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120507072123.GB19874@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jaseemabid@gmail.com \
    --cc=mk@acc.umu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).