git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Sometimes unable to lock the index during pre-commit hook
@ 2019-11-09 21:39 Réda Housni Alaoui
  2019-11-10  7:26 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Réda Housni Alaoui @ 2019-11-09 21:39 UTC (permalink / raw)
  To: git

Hi everyone,

I am the maintainer of https://github.com/Cosium/maven-git-code-format/.
maven-git-code-format is a code formatter plugin triggered by git
pre-commit hook.
On pre-commit, the plugin make use of https://www.eclipse.org/jgit/ to
alter the git index to format files.

When performing:
  git add . && git commit -m "Test"
The plugin works without issues

But when performing instead:
  git commit -am "Test"
The plugin fails because it can't lock the index file.

With the commit "all" command, it seems that the index is locked at
https://github.com/git/git/blob/master/builtin/commit.c#L419 and kept
locked during the pre commit hooks execution.

This difference of behaviour with or without "all" option leaves me puzzled.
Are pre-commit hooks expected to be able to manipulate the index?
If yes, can we call the current commit "all" behaviour a bug?
If no, is there a document specifying what hooks are authorized to do?

Thanks in advance

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-11-11 18:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09 21:39 Sometimes unable to lock the index during pre-commit hook Réda Housni Alaoui
2019-11-10  7:26 ` Junio C Hamano
2019-11-10  9:10   ` Réda Housni Alaoui
2019-11-11  2:23   ` Junio C Hamano
2019-11-11 18:37     ` Réda Housni Alaoui

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).