You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in the CLI we have this fun snippet, designed to handle the case where you are in a subdirectory of a git repo and want to do a lolcommits command:
defself.change_dir_to_root_or_repo!debug'Walking up dir tree'loopdocur=File.expand_path('.')nxt=File.expand_path('..',cur)ifnxt == curwarn'Repository root not found'returnendreturnifVCSInfo.repo_root?Dir.chdir(nxt)endend
This is actually invoked as part of the CLI logic, and the main library just assumes the PWD is in the correct place.
Rather, instead of manually walking the directory hierarchy upwards, we should use the built-in VCS support in both git and hg to determine the proper paths. This could/should be handled transparently in the lib/backends library, outside of the CLI, so things "just work" when using lolcommits as an API.
For reference, the commands we would probably be utilizing are:
git rev-parse --show-toplevel
git rev-parse --git-dir
hg root
This will have the added benefit of making lolcommits work with git submodules (which store their info somewhere else besides PWD/.git, but --git-dir will find it successfully.)
The text was updated successfully, but these errors were encountered:
Currently in the CLI we have this fun snippet, designed to handle the case where you are in a subdirectory of a git repo and want to do a lolcommits command:
This is actually invoked as part of the CLI logic, and the main library just assumes the PWD is in the correct place.
Rather, instead of manually walking the directory hierarchy upwards, we should use the built-in VCS support in both git and hg to determine the proper paths. This could/should be handled transparently in the
lib/backends
library, outside of the CLI, so things "just work" when using lolcommits as an API.For reference, the commands we would probably be utilizing are:
git rev-parse --show-toplevel
git rev-parse --git-dir
hg root
This will have the added benefit of making lolcommits work with git submodules (which store their info somewhere else besides
PWD/.git
, but--git-dir
will find it successfully.)The text was updated successfully, but these errors were encountered: