Coder Social home page Coder Social logo

Comments (5)

jgallinari avatar jgallinari commented on June 19, 2024 1

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.

qgadrian avatar qgadrian commented on June 19, 2024

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.

jgallinari avatar jgallinari commented on June 19, 2024

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.

qgadrian avatar qgadrian commented on June 19, 2024

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?

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 ☺️. It would be very helpful to speed up things if you can provide an example project to reproduce the issue.

from elixir_git_hooks.

qgadrian avatar qgadrian commented on June 19, 2024

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.