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

Fix git/hg detection in sub directories #69

Merged
merged 1 commit into from
Mar 22, 2017

Conversation

varac
Copy link
Contributor

@varac varac commented Mar 22, 2017

Before, detecting whether tests are run in a git/hg versioned
project was only successful when running them from the root
directory.
This resulted in a "unversioned" commit_info.id.

This change fixes git/hg repo detection and properly sets the
commit_info.id even when running in a sub directory.

@varac varac force-pushed the fix_subdir_commitid branch from ffe412a to 7348140 Compare March 22, 2017 12:30
@ionelmc
Copy link
Owner

ionelmc commented Mar 22, 2017

Good catch but perhaps there's a better way that also work on windows? Wouldn't just looking for .hg/.git dirs up to 10 (or so) parent dirs be enough?

@varac
Copy link
Contributor Author

varac commented Mar 22, 2017

@ionelmc Why would my change not work on windows ?

@ionelmc
Copy link
Owner

ionelmc commented Mar 22, 2017

No such thing as /dev/null on Windows. A better way is to use the subprocess module. An even better way is to check that the directories exist (check few parents).

@varac
Copy link
Contributor Author

varac commented Mar 22, 2017

oh sure. I'll check subprocess, because I thinks it's easier to use git/hg itself to determine if it's a git/hg repo. There will be someone who will come around with 11 layers of sudirectories :D

Before, detecting whether tests are run in a git/hg versioned
project was only successful when running them from the root
directory.
This resulted in a "unversioned" commit_info.id.

This change fixes git/hg repo detection and properly sets the
commit_info.id even when running in a sub directory.
@varac varac force-pushed the fix_subdir_commitid branch from 7348140 to ef673e5 Compare March 22, 2017 20:17
@varac
Copy link
Contributor Author

varac commented Mar 22, 2017

Ok this should work on Windows as well now.

@ionelmc ionelmc merged commit b341e89 into ionelmc:master Mar 22, 2017
@ionelmc
Copy link
Owner

ionelmc commented Mar 22, 2017

Alright, thanks.

@varac
Copy link
Contributor Author

varac commented Mar 22, 2017

Thx !

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.

2 participants