R: Determine if a directory is in a git repository

in_repository {git2r} | R Documentation

## Determine if a directory is in a git repository

### Description

The lookup start from path and walk across parent directories if nothing has been found.

### Usage

    in_repository(path)

    ## S4 method for signature 'missing'
    in_repository()

    ## S4 method for signature 'character'
    in_repository(path)

### Arguments

`path` | The path to the directory. The working directory is used if path is missing.

### Value

TRUE if directory is in a git repository else FALSE

### Examples

    ## Not run:
    ## Initialize a temporary repository
    path <- tempfile(pattern="git2r-")
    dir.create(path)
    repo <- init(path)

    ## Create a user
    config(repo, user.name="Alice", user.email="alice@example.org")

    ## Check if path is in a git repository
    in_repository(path)

    ## Check if working directory is in a git repository
    setwd(path)
    in_repository()

    ## End(Not run)

[Package git2r version 0.21.0 Index]