From: Joey Hess <joey@kitenet.net>
To: git@vger.kernel.org
Subject: Re: is it kosher for pre-commit to change what's staged?
Date: Wed, 10 Nov 2010 16:45:42 -0400 [thread overview]
Message-ID: <20101110204542.GA11201@gnu.kitenet.net> (raw)
In-Reply-To: <20101110200650.GA13439@burratino>
[-- Attachment #1: Type: text/plain, Size: 1532 bytes --]
Jonathan Nieder wrote:
> In this case, isn't it only a half accident? For example, I think
> v1.5.4-rc0~78^2~12 (builtin-commit: fix partial-commit support,
> 2007-11-18) taught git to support this a little better.
Partial commits modified by pre-commit still don't work entirely right IME.
After the commit, the index is such that git wants to revert any changes
added to the commit by the pre-commit hook.
> That said, I would be interested to hear the use case, since modifying
> staged content on the fly for a commit sounds a little crazy. :)
Well, with git-annex (which I should probably properly announce here
sometime), large files are not committed to git, but instead a symlink
pointing at the content is committed. That symlink can temporarily be
replaced with a copy of the file when the user wants to modify it, and
if the user then commits, it's nice if it can move away the large file's
content, and arrange for the commit to contain an updated symlink pointing
at the new content.
That said, since git commit stages the whole large file into the index,
which is the kind of expensive operation git-annex exists to avoid,
it's still not very practical to intercept the commit like that. What
I ideally need is a hook that is run before git commit stages anything.
BTW, githooks says pre-commit is "invoked before obtaining the proposed
commit log message", which is a bit confusing. I actually see
prepare-commit-msg and commit-msg both called after pre-commit.
--
see shy jo
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2010-11-10 20:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-10 17:08 is it kosher for pre-commit to change what's staged? Joey Hess
2010-11-10 19:57 ` Junio C Hamano
2010-11-10 20:06 ` Jonathan Nieder
2010-11-10 20:45 ` Joey Hess [this message]
2010-11-10 22:17 ` Dmitry Potapov
2010-11-11 19:26 ` Jan Hudec
2010-11-11 20:46 ` Joey Hess
2010-11-11 22:03 ` Junio C Hamano
2010-11-11 22:06 ` Kevin Ballard
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=20101110204542.GA11201@gnu.kitenet.net \
--to=joey@kitenet.net \
--cc=git@vger.kernel.org \
/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 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 NNTP newsgroup(s).