Skip to content

Commit 5b2067d

Browse files
committed
Cleanup temporary repository
1 parent cd77539 commit 5b2067d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

R/remote.r

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ setMethod("remote_url",
372372
setGeneric("remote_ls",
373373
signature = c("name"),
374374
function(name,
375-
repo = git2r::init(tempdir()),
375+
repo = NULL,
376376
credentials = NULL)
377377
standardGeneric("remote_ls"))
378378

@@ -382,6 +382,12 @@ setMethod("remote_ls",
382382
signature(name = "character"),
383383
function(name, repo, credentials)
384384
{
385+
if (is.null(repo)) {
386+
path <- tempdir()
387+
repo <- git2r::init(path)
388+
on.exit(unlink(file.path(path, ".git"), recursive = TRUE))
389+
}
390+
385391
.Call(git2r_remote_ls, name, repo, credentials)
386392
}
387393
)

man/remote_ls-methods.Rd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
\alias{remote_ls,character-method}
77
\title{List references in a remote repository}
88
\usage{
9-
remote_ls(name, repo = git2r::init(tempdir()), credentials = NULL)
9+
remote_ls(name, repo = NULL, credentials = NULL)
1010

11-
\S4method{remote_ls}{character}(name, repo = git2r::init(tempdir()),
12-
credentials = NULL)
11+
\S4method{remote_ls}{character}(name, repo = NULL, credentials = NULL)
1312
}
1413
\arguments{
1514
\item{name}{Character vector with the "remote" repository URL to query or

0 commit comments

Comments
 (0)