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

git: always set GIT_CEILING_DIRECTORIES #636

Merged
merged 4 commits into from
May 1, 2018

Conversation

philpep
Copy link
Contributor

@philpep philpep commented Apr 30, 2018

By default when git don't find a repository in current working dir, it
search for git repository in parent directories.

This may lead to unwanted behavior when the benchmarked repository is
nested inside other repo since in checkout() we expect to given path
to be the repository and re-clone it if it's not. When the given path is
not a repository we may run git commands (like a checkout) on unrelated
repo.

This bug occur in appveyor tests where --basetemp is set to a
directory inside asv checkout, and test_repo.test_repo_git() run a
checkout() after rm -rf .git causing tests to run a git checkout -f master on asv repo.

We don't have similar issue with hglib since it use the -R option to
explicitly set the repository root.

@pv
Copy link
Collaborator

pv commented Apr 30, 2018 via email

@philpep
Copy link
Contributor Author

philpep commented Apr 30, 2018

Ok fixed in 0196448

pitrou and others added 2 commits April 30, 2018 21:06
By default when git don't find a repository in current working dir, it
search for git repository in parent directories.

This may lead to unwanted behavior when the benchmarked repository is
nested inside other repo since in `checkout()` we expect to given path
to be the repository and re-clone it if it's not. When the given path is
not a repository we may run git commands (like a checkout) on unrelated
repo.

This bug occur in appveyor tests where `--basetemp` is set to a
directory inside asv checkout, and `test_repo.test_repo_git()` run a
checkout() after `rm -rf .git` causing tests to run a `git checkout -f
master` on asv repo.

Always set GIT_CEILING_DIRECTORIES to parent directory of the repo path
to avoid git looking at parent directories.

We don't have similar issue with hglib since it use the `-R` option to
explicitly set the repository root.
@pv
Copy link
Collaborator

pv commented Apr 30, 2018

Needs some tuning and a test (I'll take a look now)

@pv
Copy link
Collaborator

pv commented Apr 30, 2018

GIT_CEILING_DIRECTORIES is colon-separated, not nice on Windows :(
ok, it seems os.pathsep works after all

@pv pv force-pushed the fix-git-root branch 2 times, most recently from caa40bb to 2d1f8a0 Compare May 1, 2018 01:26
@pv pv force-pushed the fix-git-root branch from 2d1f8a0 to 2da87d6 Compare May 1, 2018 01:38
@pv pv merged commit b3d1676 into airspeed-velocity:master May 1, 2018
@philpep
Copy link
Contributor Author

philpep commented May 1, 2018

Thanks for fixing this and added tests!

pv added a commit to pv/asv that referenced this pull request Jul 8, 2018
git: always set GIT_CEILING_DIRECTORIES
(cherry picked from commit b3d1676)
pv added a commit to pv/asv that referenced this pull request Jul 8, 2018
git: always set GIT_CEILING_DIRECTORIES

(cherry picked from commit b3d1676)
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.

3 participants