Coder Social home page Coder Social logo

Comments (7)

felipeloha avatar felipeloha commented on June 20, 2024 1

you can workaround this with the following configuration
mix_path: "cd my_app && mix",

from elixir_git_hooks.

qgadrian avatar qgadrian commented on June 20, 2024 1

Closing this issue as it should be fixed in the latest release

from elixir_git_hooks.

felipeloha avatar felipeloha commented on June 20, 2024

+1

from elixir_git_hooks.

qgadrian avatar qgadrian commented on June 20, 2024

It's been a while, but this got fixed 49ca50e

I just tested a submodule project and the hooks are installed under .git/modules/my-other-project/hooks/

@colinsmetz can you check the pre-release v0.6.6-pre?

from elixir_git_hooks.

colinsmetz avatar colinsmetz commented on June 20, 2024

I don't use submodules, so I'm not sure my issue was clear.

I just tried again using the tag v0.6.6-pre and I mostly have the same behaviours :

  • The git hook is installed in my_app/deps/.git/pre-commit when I do a mix compile
  • If I run mix git_hooks.install it uses my git_path. There was a difference though. With the git_path set to ../.git (as I did before), the pre-commit hook is created at .git/pre-commit instead of .git/hooks/pre-commit. I had to set it to ../git/hooks now.
  • The pre-commit script does not cd inside the folder with the Elixir project, so it fails

Note that I may have misunderstood the point of git_path. Is it limited to git submodules only?

from elixir_git_hooks.

colinsmetz avatar colinsmetz commented on June 20, 2024

you can workaround this with the following configuration
mix_path: "cd my_app && mix",

Thanks, that solves my last point indeed.

from elixir_git_hooks.

qgadrian avatar qgadrian commented on June 20, 2024

I don't use submodules, so I'm not sure my issue was clear.

I just tried again using the tag v0.6.6-pre and I mostly have the same behaviours :

* The git hook is installed in `my_app/deps/.git/pre-commit` when I do a `mix compile`

* If I run `mix git_hooks.install` it uses my `git_path`. There was a difference though. With the `git_path` set to `../.git` (as I did before), the pre-commit hook is created at `.git/pre-commit` instead of `.git/hooks/pre-commit`. I had to set it to `../git/hooks` now.

* The pre-commit script does not `cd` inside the folder with the Elixir project, so it fails

Note that I may have misunderstood the point of git_path. Is it limited to git submodules only?

git_path is not limited to submodules, actually, it should not be used on git submodules and this project supports them out of the box without any additional configuration.

I just tested an elixir project in a subfolder, and the following config installed the hooks on the correct parent path when running mix deps.compile git_hooks.

  config :git_hooks,
    git_path: "../.git",
    auto_install: true,
    verbose: true,
    hooks: [
      pre_commit: [
        tasks: [
          {:mix_task, :format, ["--dry-run", "--check-formatted"]}
        ]
      ]
    ]

image

I don't link the git_path config, the name is misleading and the path should be resolved automatically. So thanks to the changes on this PR you won't need to set any custom path, it will just work (hopefully).

I just tested myself with both git submodules and a simple elixir subfolder (no submodule) and both the install and the hooks worked fine. There is a pre-release available on hex.

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.