From: Duy Nguyen <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Niek van der Kooy <niekvanderkooy@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Issue when changing staged files in a pre-commit hook
Date: Wed, 20 Jan 2016 06:26:35 +0700 [thread overview]
Message-ID: <CACsJy8DxQnGV5JZnHuvA1Zbpf2BuGdmMF+YNiq51HNK+8vW56Q@mail.gmail.com> (raw)
In-Reply-To: <xmqq1t9dbe9y.fsf@gitster.mtv.corp.google.com>
On Wed, Jan 20, 2016 at 1:44 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Duy Nguyen <pclouds@gmail.com> writes:
>
>> I think it's the intended behavior.
>
> Yeah, pre-commit was designed for inspecting and rejecting, not for
> tweaking and munging. Perhaps "git commit" can be tightened to make
> sure that pre-commit that returns successfully did not muck with the
> working tree and the index?
That was my impression from the docs, but then I saw this comment,
/*
* Re-read the index as pre-commit hook could have updated it,
* and write it out as a tree. We must do this before we invoke
* the editor and after we invoke run_status above.
*/
which comes from 2888605 (builtin-commit: fix partial-commit support -
2007-11-18) that admits "the hook can modify it (the index)". And I
was about to update the docs, but the other way around, about updating
index and side effects.
--
Duy
next prev parent reply other threads:[~2016-01-19 23:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-28 12:17 Issue when changing staged files in a pre-commit hook Niek van der Kooy
2016-01-19 11:53 ` Niek van der Kooy
2016-01-19 12:20 ` Duy Nguyen
2016-01-19 18:44 ` Junio C Hamano
2016-01-19 23:26 ` Duy Nguyen [this message]
2016-01-19 23:41 ` Junio C Hamano
2016-01-20 0:23 ` Duy Nguyen
2016-01-20 1:44 ` Junio C Hamano
2016-01-22 8:58 ` Duy Nguyen
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=CACsJy8DxQnGV5JZnHuvA1Zbpf2BuGdmMF+YNiq51HNK+8vW56Q@mail.gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=niekvanderkooy@gmail.com \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.