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

Can rprojroot handle separated git directories? #24

Closed
karldw opened this issue Jun 8, 2017 · 3 comments · Fixed by #25
Closed

Can rprojroot handle separated git directories? #24

karldw opened this issue Jun 8, 2017 · 3 comments · Fixed by #25

Comments

@karldw
Copy link
Contributor

karldw commented Jun 8, 2017

Git allows you to separate the .git folder from the project. For example:

git clone --separate-git-dir="$HOME/my_rprojroot.git" git@github.com:krlmlr/rprojroot.git

After running the command above, I have a .git file in the cloned rprojroot directory, which rprojroot doesn't recognize as a project criterion.

Could rprojroot handle separated git directories? One option would be changing the code to:

is_git_root <- has_dir(".git") | has_file(".git", contents = "^gitdir: ")

If that sounds good, I can pull together a PR.

@krlmlr
Copy link
Member

krlmlr commented Jun 8, 2017

Thanks, a PR would be great. In which lines of the .git file can the gitdir string appear?

@karldw
Copy link
Contributor Author

karldw commented Jun 9, 2017

I think it's always created as a one-line file, but I'm not positive. (Here's the source.)

.git can also be a symbolic link to a file or directory, but file.exists, readLines and dir.exists already follow symbolic links, so that should be fine.
(has_file(contents = ...) eventually calls to readLines.)

krlmlr added a commit that referenced this issue Jun 10, 2017
- Detect `.git` directories created with `git clone --separate-git-dir=...` (#24, @karldw).
krlmlr added a commit that referenced this issue Jun 10, 2017
- Detect `.git` directories created with `git clone --separate-git-dir=...` (#24, @karldw).
krlmlr added a commit that referenced this issue Dec 18, 2017
- Adapt to testthat 2.0.0.
- New `thisfile()`, moved from kimisc (#8).
- Add more examples to vignette (#26, @BarkleyBG).
- Detect `.git` directories created with `git clone --separate-git-dir=...` (#24, @karldw).
@github-actions
Copy link

github-actions bot commented Dec 8, 2020

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2020
krlmlr pushed a commit that referenced this issue Oct 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants