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 · 2 comments

Comments

Projects
None yet
2 participants
@karldw
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

commented Jun 8, 2017

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

@karldw

This comment has been minimized.

Copy link
Contributor Author

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 krlmlr closed this in #25 Jun 10, 2017

krlmlr added a commit that referenced this issue Jun 10, 2017

Merge pull request #25 from karldw/master
- Detect `.git` directories created with `git clone --separate-git-dir=...` (#24, @karldw).

krlmlr added a commit that referenced this issue Jun 10, 2017

Merge tag 'v1.2-10'
- Detect `.git` directories created with `git clone --separate-git-dir=...` (#24, @karldw).

krlmlr added a commit that referenced this issue Dec 18, 2017

Merge tag 'v1.3-1'
- 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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.