Skip to content

stop upwards search if find .hg as well as .git directory #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/plx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ sub _build_layout_base_dir {
while (@parts > 1) { # go back to one step before root at most
$cand = $fs->catdir(@parts);
return $cand if -d $fs->catdir($cand, '.plx');
if (-d $fs->catdir($cand, '.git')) { # don't escape current repository
$reason = ' due to .git directory';
if ( (my $vcs) = grep { -d $fs->catdir($cand, $_) } '.git', '.hg' ) { # don't escape current repository
$reason = " due to $vcs directory";
last;
}
pop @parts;
Expand Down Expand Up @@ -921,7 +921,7 @@ Identical to C<--init> but creates no default configs except for C<perl>.
Without arguments, shows the selected base dir - C<plx> finds this by
checking for a C<.plx> directory in the current directory, and if not tries
the parent directory, recursively. The search stops either when C<plx> finds
a C<.git> directory, to avoid accidentally escaping a project repository, or
a C<.git> or C<.hg> directory, to avoid accidentally escaping a project repository, or
at the last directory before the root - i.e. C<plx> will test C</home> but
not C</>.

Expand Down