jish/pre-commit

Feature request: should add recursive traversing

Closed this issue · 6 comments

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

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

jfly commented

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

jish commented

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

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

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

That's it exactly! PR here: #221