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

Re: is it kosher for pre-commit to change what's staged?

From
JHJan Hudec <bulb@ucw.cz>
Date
Nov 11, 2010, 19:26 UTC
Message-ID
<20101111192648.GE30870@efreet.light.src>
In-Reply-To
<AANLkTi=W_hwU=3PTTqE4R8Cg5T=GMdMfBsKQ1YE0HWRe@mail.gmail.com>
On Thu, Nov 11, 2010 at 01:17:04 +0300, Dmitry Potapov wrote:
Show 10 quoted lines
> On Wed, Nov 10, 2010 at 11:45 PM, Joey Hess <joey@kitenet.net> wrote:
> >
> > 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.
> 
> Then maybe you should look at git smudge&clean filters. They perform
> conversation between the working tree and the index.  Though I am not
> sure how well they work with big files.

The problem point is not big files, but whether they can change the file mode associated with the entry, since in this case the tree contains a file, but index should contain a symlink. Looking at the documentation, there does not seem to be a way to do it.

It might be worth adding support for it now we have a use-case.
-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
Previous: Dmitry PotapovNext: Joey Hess
Message 6 of 9 in “is it kosher for pre-commit to change what's staged?”
  1. Joey HessNov 10, 2010
  2. Junio C HamanoNov 10, 2010
  3. Jonathan NiederNov 10, 2010
  4. Joey HessNov 10, 2010
  5. Dmitry PotapovNov 10, 2010
  6. Jan HudecNov 11, 2010
  7. Joey HessNov 11, 2010
  8. Junio C HamanoNov 11, 2010
  9. Kevin BallardNov 11, 2010

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.