Code Monkey home page Code Monkey logo

Comments (10)

ZLLentz avatar ZLLentz commented on August 29, 2024 3

Running inside a git directory and iterating through the options for specifying directories made it work, I just had to specify it as C:\Users\zlentz\.git-template

from pre-commit-hooks.

ZLLentz avatar ZLLentz commented on August 29, 2024 2

This totally blows up on my windows, but seems to have worked nicely for my linux desktop. Note that you may want to edit the shebang on the script after it is generated, for mine it was hardcoded to try python3.8 which requires that I be in a python3.8 environment when making git commits...

from pre-commit-hooks.

ZLLentz avatar ZLLentz commented on August 29, 2024 1

This is neat, it only requires that each user pick a template dir and run one git and one pre-commit command on each machine they want to set it up for. It does still require that you have a viable pre-commit python environment on that machine to run the pre-commit command with. We should check out how the resulting hook script looks and add instructions to this repo.

from pre-commit-hooks.

ZLLentz avatar ZLLentz commented on August 29, 2024 1

After editing the shebang to just python, this seems to work great on linux.

from pre-commit-hooks.

ZLLentz avatar ZLLentz commented on August 29, 2024 1

Thank you @rruiter87, I didn't know this existed. I'm definitely going to integrate it into our CI pipelines.

from pre-commit-hooks.

ZryletTC avatar ZryletTC commented on August 29, 2024

This totally blows up on my windows

Blows up how?

from pre-commit-hooks.

ZLLentz avatar ZLLentz commented on August 29, 2024

Two ways:

  1. by raising an exception on pre-commit init-templatedir ~/.git-template that doesn't make any sense and leaving a log file with no good clues. I tried the obvious things like picking different directories and making sure they existed before running the command (something I did not have to do on linux)
  2. by being unable to locate my template directory no matter how I configure it using git config --global init.templateDir (I tried to copy in a hooks file manually). I tried many different permutations of ~/.git-template, C:\\Users\zlentz\.git-template, etc.

from pre-commit-hooks.

ZryletTC avatar ZryletTC commented on August 29, 2024

Where were you running those from? I was able to set it up on my personal Windows computer just now using git-bash.

I had no problems running git config --global init.templateDir ~/.git-template.
Running pre-commit init-templatedir ~/.git-template initially complained that it wasn't inside a git directory but worked fine after I cded to a git directory (no idea why it needed to be in one though, it didn't touch it).

After set up, I was able to run pre-commit run --all-files and git commit ran the hooks from a freshly cloned repo without having to run pre-commit install.

from pre-commit-hooks.

ZLLentz avatar ZLLentz commented on August 29, 2024

I'm running it through powershell, I'll try again and do it inside an arbitrary git directory, and failing that see if it works through git bash for me. If git bash ends up being the solution to all windows problems then I am 100% ok with that.

from pre-commit-hooks.

rruiter87 avatar rruiter87 commented on August 29, 2024

Why not use https://pre-commit.ci/ ? It's free for public repos. You can enable it for pull requests to prevent PRs from messing up the repo.

from pre-commit-hooks.

Related Issues (14)

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.