bneuburg/knife-plugins — pull request #1 by spazm (2012-05-08 00:40:54+00:00)
Title: find relative paths for git to work when cookbooks not at git root.

I found knife-plugins did not work for my setup, which has my cookbooks in a subdir of a shared repository. Enclosed is a patch to walk up the tree to find the git root and then select the subtree for the cookbook directory.

Using your tool, I found four cookbooks that were out-of-date in our chef server. Most were instances where I forgot to upload them to the server after minor changes but one was where my changes had been overwritten by a coworker's upload. Thank you!!

peace,
--spazm

* detect root of git tree when called from within a subdir,
mirroring the behavior of standard git.
* find relative path to cookbooks from git_root and use the
'/' operator on the grit tree to select the subtree.
http://rubydoc.info/gems/grit/2.5.0/Grit/Tree#%2F-instance_method