jish / pre-commit

A slightly improved pre-commit hook for git
https://jish.github.io/pre-commit/
Other
796 stars 96 forks source link

Feature request: should add recursive traversing #193

Closed sudodoki closed 9 years ago

sudodoki commented 9 years ago

In my use case I have multiple folders in single repo & pre-commit doesn't traverse parent folders to find .git. To illutstrate, folder structure is something like this

.git
|--server
   |-- node_modules
      |-- pre-commit
   |-- package.json
|--client
mpapis commented 9 years ago

can you provide more details, like: cd server ; git commit

jfly commented 9 years ago

+1. This should be a simple feature to add. Would you be open to a PR for this?

jish commented 9 years ago

Sure we like pull requests! :)

I think I'm still unclear on what is actually needed here? Could you please elaborate a bit?

jfly commented 9 years ago

We should be able to run pre-commit from a subdirectory of the repository root. Right now, if you run it in a subdirectory, it doesn't search upwards for a folder containing a .git directory, it just complains that there is no .git folder.

jish commented 9 years ago

Oh, so you mean given the following structure:

repo
├── .git
├── lib
│   └── foo.rb
└── test
    └── foo_test.rb

You should be able to do the following:

$ cd lib
$ git commit

?

jfly commented 9 years ago

That's it exactly! PR here: https://github.com/jish/pre-commit/pull/221