Skip to content
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

Allow to use vpr even if you are not in the root directory #23

Merged
merged 1 commit into from
Oct 21, 2019

Conversation

schmidt
Copy link
Contributor

@schmidt schmidt commented Oct 20, 2019

Before executing git related commands, vpr will explicitly look for the .git directory in the current directory and each of it's parent, stopping at the earliest match. This way, similar to the git command line tools, vpr may be used in sub folders.

If vpr cannot find a .git directory in any of the parents, then it falls back to using the current directory.

return dir if File.directory?(File.join(dir, '.git'))

parent = File.dirname(dir)
return dir if parent == dir # we're at the root
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed to abort, when we cannot go any further to avoid endless loops.

Comment on lines +38 to +40
# TODO: replace with a human readable error message and a non-zero exit
# code
expect { described_class.repo_url }.to raise_error(ArgumentError)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, it would be nice if such an exception would result in a proper error message.

Before executing git related commands, vpr will explicitly look for the `.git` directory in the current directory and each of it's parent, stopping at the earliest match. This way, similar to the git command line tools, vpr may be used in sub folders.

If vpr cannot find a `.git` directory in any of the parents, then it falls back to using the current directory.
Copy link
Owner

@JuanCrg90 JuanCrg90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome Thanks!!!

@JuanCrg90 JuanCrg90 merged commit 3aad330 into JuanCrg90:master Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants