question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pre Commit Hook Error

See original GitHub issue

When running the precommit hook it always fails with the message:

.git/hooks/pre-commit: line 22: =0: command not found

This is probably because of this line:

$gradleCommandExitCode=$?

Imo the leading $ should be removed.

This also has the very bad sideffect that the old stash is not applied and the code that wasn’t staged is lost.

Tested on macos, Ktlint 10.2.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

2reactions
jmbarrosocommented, Jan 6, 2022

@PauloHC, after installing the pre-commit, it should be available in .git/hooks/pre-commit. Line 22 should look like $gradleCommandExitCode=$? . The workaround is to change it to gradleCommandExitCode=$?

1reaction
PauloHCcommented, Jan 6, 2022

I found the line here. Now the hook is working. Thank you very much @jmbarroso !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pre Commit hook git error - Stack Overflow
Your pre-commit file has extraneous carriage returns in it. This can happen if you edit the file in Windows and copy the file...
Read more >
pre-commit
We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements....
Read more >
Git commit hook error messages no longer display - YouTrack
Git commit hook error messages no longer display · 1. Create a new git repository · 2. Add the following pre-commit hook (and...
Read more >
Commit blocked by pre-commit hook (exit code 255) with no ...
pre-commit script, regardless of the script's contents. ... So this implies that the hook can work and may not be at fault at...
Read more >
Use Git pre-commit hooks to avoid AWS CloudFormation errors
With the approach we propose, you configure pre-commit hooks for your project and commit your changes to the repo. Then Git inspects your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found