Comments (5)
Sorry for the delay of my response.
I could not get it to work until I re-installed the git_hooks manually with mix git_hooks.install
, and suddenly it started to work as expected 😮 : .git/hooks/pre-commit got the right cd command.
Thanks for your help!
I think you can close the ticket.
from elixir_git_hooks.
Hello @jgallinari! Thanks for reporting the issue!
I believe this is the same issue as #113 correct? If that is the case, I opened a PR to validate adding a config to set up the project would work #120
In that case, if this library it's available on both of your projects it should work for both of them.
from elixir_git_hooks.
Hello,
Not sure to understand how it's supposed to work 😞
In repo/app1/config/config.exs
, I put:
if Mix.env() != :prod do
config :git_hooks,
project_path: "./app1",
auto_install: true,
verbose: true,
hooks: [
pre_commit: [
tasks: [
{:cmd, "mix credo"},
And then, by installing, I got
repo/app1> mix git_hooks.install
↗ Installing git hooks...
↗ Writing git hook for `pre_commit` to `../.git/hooks/pre-commit`
↗ Backing up git hook file `../.git/hooks/pre-commit` to `../.git/hooks/pre-commit.pre_git_hooks_backup`
↗ Writing git hook for `pre_push` to `../.git/hooks/pre-push`
↗ Backing up git hook file `../.git/hooks/pre-push` to `../.git/hooks/pre-push.pre_git_hooks_backup`
and repo/.git/hooks/pre-commit
now contains:
#!/bin/sh
[ "./app1" != "" ] && cd "./app1"
mix git_hooks.run pre_commit "$@"
[ $? -ne 0 ] && exit 1
exit 0
which works.
But what am I supposed to do with repo/app2
then?
I don't see how repo/app1
and repo/app2
can co-exist with a common config in repo/.git/hooks/pre-commit
, can't they?
from elixir_git_hooks.
Hello, Not sure to understand how it's supposed to work 😞 In
repo/app1/config/config.exs
, I put:if Mix.env() != :prod do config :git_hooks, project_path: "./app1", auto_install: true, verbose: true, hooks: [ pre_commit: [ tasks: [ {:cmd, "mix credo"},And then, by installing, I got
repo/app1> mix git_hooks.install ↗ Installing git hooks... ↗ Writing git hook for `pre_commit` to `../.git/hooks/pre-commit` ↗ Backing up git hook file `../.git/hooks/pre-commit` to `../.git/hooks/pre-commit.pre_git_hooks_backup` ↗ Writing git hook for `pre_push` to `../.git/hooks/pre-push` ↗ Backing up git hook file `../.git/hooks/pre-push` to `../.git/hooks/pre-push.pre_git_hooks_backup`and
repo/.git/hooks/pre-commit
now contains:#!/bin/sh [ "./app1" != "" ] && cd "./app1" mix git_hooks.run pre_commit "$@" [ $? -ne 0 ] && exit 1 exit 0which works. But what am I supposed to do with
repo/app2
then? I don't see howrepo/app1
andrepo/app2
can co-exist with a common config inrepo/.git/hooks/pre-commit
, can't they?
If it's an umbrella application, if both applications use this library you can have this library configured at the root config file instead of on each application.
If it's not an umbrella application I can try to dig more to support your case
from elixir_git_hooks.
@jgallinari glad to hear. If you have any issues please free to ping me here or open a new ticket
from elixir_git_hooks.
Related Issues (20)
- With older git returns an error HOT 2
- Don't run the hook when nothing in the project root has changed HOT 1
- 0.6.5 release HOT 2
- Add support to mix tasks results HOT 1
- Compilation error when export `deps_path` is set HOT 13
- git_hooks.run not found HOT 1
- mix compile --warnings-as-errors succeeds, but git_hooks registers as a failure HOT 3
- Pre commit/push hooks fail in the latest version HOT 13
- Document how to override the MIX_ENV when running hooks HOT 5
- feature request: allow tasks to be configured to run in parallel HOT 1
- Confusion after rebuilding dependencies until git_hooks.install HOT 7
- Seeing please ensure :git_hooks exists or remove the configuration. HOT 2
- Using && within a :cmd appears to be a problem?
- Running pre-commit hook only for staged files
- Cut a new release with updated dependencies HOT 2
- Pre-commit hook appears execute after commit has taken place HOT 10
- [Feature request] overriding the git hook so that we can make it run mix tasks inside of docker compose HOT 6
- Configurability to run hooks only on a certain branch HOT 1
- Invalid hook path and script when using git_path HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elixir_git_hooks.