Issue title: Locate repo from subdir or active repo
 Issue body: See discussion here https://github.com/r-lib/gert/pull/6
 Comments: 
 Comment 0: @jennybc @richfitz The commit above changes the default so that it now searches parent directories for the git repo. I think this behavior matches the command line `git`. 

Does this make sense or should the user be able to explicitly specify wether or not to search parent directories for a `.git` folder?
 Comment 1: I suppose you (or someone) will need a way to prevent recursive upward search. The fact that `git2r38d1:d2b4:3d06:83e8:96a5:8c2:893d:aba5iscover_repository()` has a related `ceiling` argument supports the idea that there needs to be some way to control this.

But I think this need is pretty rare, so it could be semi-inconvenient. Would a withr-style `with_()` or `local_()` function be the way to do it? Because I imagine most repo discovery is happening automatically, i.e. not from a direct call.
 Comment 2: Yes this is a standard API: https://libgit2.org/libgit2/#HEAD/group/repository/git_repository_discover

I have never run into a case where you need a "ceiling" parameter so I'm not sure how useful it is to expose all that, but if it is we can wrap the argument of course.


 Comment 3: I think the only time I felt the need for it was writing tests for my own attempt at a wrapper around git2r, with git repos that were test fixtures. And the much better solution there was to always put the test repos below session temp dir, instead of below the package itself.
 Comment 4: This is already sorted out.

By default `git_open()` will search recursively up and `git_open()` is used to process `repo` all over the place. So recursive search works in general and default behaviour.

However, if someone really wants to prevent that, they can pass a path protected by `I()`, which was already in place before I started working here. I have now documented this behaviour and added a test.
{'source': 'GithubIssues', 'repo_name_with_owner': 'r-lib/gert', 'issue_id': 468367456, 'repo_stars': 115.0}