You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Tomoko Uchida (Jira)" <ji...@apache.org> on 2021/07/17 13:06:00 UTC

[jira] [Updated] (LUCENE-10028) Optionally allow to enable git pre-commit hook for precommit

     [ https://issues.apache.org/jira/browse/LUCENE-10028?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tomoko Uchida updated LUCENE-10028:
-----------------------------------
    Description: 
With [githooks|https://git-scm.com/docs/githooks], one can automatically perform arbitrary checks (e.g. "precommit") when before performing "git commit".

I found the "precommit" check is now pretty fast on main branch, it might make sense for developers who want to run it in an automated manner (to prevent premature commits ore push).

*Implementation*

Hooks are just plain shell scripts that are placed in .git/hooks, so we can provide a simple executable "pre-commit" script that runs "gradlew precommit" and a gradle Copy task to copy it under local .git/hooks dir.

*Usage*

Install pre-commit hook (opt-in)
{code:java}
./gradlew precommitHook
{code}
After installing, precommit will be automatically performed before every commit.
{code:java}
git commit -m "commit attempt that doesn't pass spotless check"
......
> Task :lucene:luke:spotlessJavaCheck FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lucene:luke:spotlessJavaCheck'.
> The following files had format violations:
......
{code}
 

  was:
With [githooks|https://git-scm.com/docs/githooks], one can automatically perform {{arbitrary }}checks (e.g. "precommit") when before performing "git commit".

I found the precommit check is now pretty fast on main branch, it might make sense for developers who want to run it in an automated manner (to prevent premature commits ore push).

*Implementation*

Hooks are just plain shell scripts that are placed in .git/hooks, so we can provide a simple executable "pre-commit" script that runs "gradlew precommit" and a gradle Copy task to copy it under local .git/hooks dir.

*Usage*

Install pre-commit hook (opt-in)
{code:java}
./gradlew precommitHook
{code}
After installing, precommit will be automatically performed before every commit.
{code:java}
git commit -m "commit attempt that doesn't pass spotless check"
......
> Task :lucene:luke:spotlessJavaCheck FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lucene:luke:spotlessJavaCheck'.
> The following files had format violations:
......
{code}
 


> Optionally allow to enable git pre-commit hook for precommit
> ------------------------------------------------------------
>
>                 Key: LUCENE-10028
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10028
>             Project: Lucene - Core
>          Issue Type: Task
>          Components: general/build
>            Reporter: Tomoko Uchida
>            Priority: Minor
>
> With [githooks|https://git-scm.com/docs/githooks], one can automatically perform arbitrary checks (e.g. "precommit") when before performing "git commit".
> I found the "precommit" check is now pretty fast on main branch, it might make sense for developers who want to run it in an automated manner (to prevent premature commits ore push).
> *Implementation*
> Hooks are just plain shell scripts that are placed in .git/hooks, so we can provide a simple executable "pre-commit" script that runs "gradlew precommit" and a gradle Copy task to copy it under local .git/hooks dir.
> *Usage*
> Install pre-commit hook (opt-in)
> {code:java}
> ./gradlew precommitHook
> {code}
> After installing, precommit will be automatically performed before every commit.
> {code:java}
> git commit -m "commit attempt that doesn't pass spotless check"
> ......
> > Task :lucene:luke:spotlessJavaCheck FAILED
> FAILURE: Build failed with an exception.
> * What went wrong:
> Execution failed for task ':lucene:luke:spotlessJavaCheck'.
> > The following files had format violations:
> ......
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org