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

Re: is there a reason pre-commit.sample uses "git diff-index"?

From
Robert P. J. Day <rpjday@crashcourse.ca>
Date
May 31, 2018, 23:09 UTC
Message-ID
<alpine.LFD.2.21.1805311907280.19720@localhost.localdomain>
In-Reply-To
<f27d8344-4acb-3e87-3bd9-b23b21c4b82a@kdbg.org>
On Fri, 1 Jun 2018, Johannes Sixt wrote:
Show 23 quoted lines
> Am 31.05.2018 um 19:27 schrieb Robert P. J. Day:
> > On Thu, 31 May 2018, Duy Nguyen wrote:
> >> git diff-index is "plumbing", designed for writing scripts. "git
> >> diff" on the other hand is for users and its behavior may change
> >> even if it breaks backward compatibility.
> >
> >    ah, this was a philosophical underpinning i was unaware of. i
> > see occasional explanations of git porcelain versus plumbing, but
> > i don't recall anyone simply stating that the plumbing is meant to
> > have a long-term stability that is not guaranteed for the
> > porcelain.
>
> So, there you have it. ;) Plumbing commands offer long-term
> stability. That is not just philosophical, but practically relevant.
>
> >    in any event, this does mean that, stability issues aside, "git
> > diff" would apparently have worked just fine for that hook.
>
> It may have worked just fine. You should still not use it.
>
> Didn't you say that you are teaching git and hooks? Then you should
> teach the right thing, and the right thing is to use plumbing for
> scripts.
  sure, i agree, but i don't recall *ever* running across the claim
that the "plumbing" commands had a long-term stability and backward
compatibility that the porcelain commands did not. is that mentioned
anywhere?
rday
-- 
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
Previous: Johannes SixtNext: Stefan Beller
Message 6 of 8 in “is there a reason pre-commit.sample uses "git diff-index"?”
  1. Robert P. J. DayMay 31, 2018
  2. Duy NguyenMay 31, 2018
  3. Robert P. J. DayMay 31, 2018
  4. Duy NguyenMay 31, 2018
  5. Johannes SixtMay 31, 2018
  6. Robert P. J. DayMay 31, 2018
  7. Stefan BellerMay 31, 2018
  8. Junio C HamanoJun 1, 2018

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.