Running 'add-force.R' [0s]
  Running 'bare_repository.R' [0s]
  Running 'blame.R' [0s]
  Running 'blob.R' [0s]
  Running 'branch.R' [1s]
  Running 'bundle.R' [171s]
  Running 'checkout-named-branch.R' [155s]
  Running 'checkout.R' [1s]
  Running 'checkout_branch.R' [150s]
  Running 'checkout_commit.R' [0s]
  Running 'checkout_tag.R' [0s]
  Running 'clone_bare.R' [0s]
  Running 'clone_branch.R' [0s]
  Running 'clone_checkout.R' [0s]
  Running 'commit.R' [1s]
  Running 'commits_path.R' [172s]
  Running 'config.R' [173s]
  Running 'diff.R' [170s]
  Running 'fast_forward_merge.R' [0s]
  Running 'fetch.R' [0s]
  Running 'graph.R' [0s]
  Running 'index.R' [160s]
  Running 'invalid-conf-var.R' [150s]
  Running 'libgit2.R' [174s]
  Running 'ls_tree.R' [0s]
  Running 'merge.R' [1s]
  Running 'merge_named_branch.R' [1s]
  Running 'normal_merge.R' [1s]
  Running 'note.R' [1s]
  Running 'odb_blobs.R' [171s]
  Running 'pre-process-path.R' [0s]
  Running 'pull.R' [1s]
  Running 'push-force.R' [1s]
  Running 'push.R' [1s]
  Running 'reference.R' [171s]
  Running 'reflog.R' [0s]
  Running 'refspec.R' [173s]
  Running 'remotes.R' [166s]
  Running 'remove.R' [0s]
  Running 'repository.R' [171s]
  Running 'reset.R' [159s]
  Running 'revparse.R' [158s]
  Running 'signature.R' [167s]
  Running 'stash.R' [0s]
  Running 'status.R' [0s]
  Running 'tag.R' [0s]
  Running 'time.R' [158s]
  Running 'tree.R' [1s]
  Running 'when.R' [0s]
Running the tests in 'tests/bundle.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(file.path(path, "bundle", "R"), recursive = TRUE)
  > 
  > ## Initialize a repository
  > repo <- init(file.path(path, "bundle"))
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create a DESCRIPTION file
  > writeLines(c(
  +     "package: bundle",
  +     "Title: Bundle Git Repository",
  +     "Description: Bundle a bare repository of the code in the 'inst' folder.",
  +     "Version: 0.1",
  +     "License: GPL-2",
  +     "Authors@R: person('Alice', role = c('aut', 'cre'),",
  +     "                  email = 'alice@example.org')"),
  +     con = file.path(path, "bundle", "DESCRIPTION"))
  > add(repo, file.path(path, "bundle", "DESCRIPTION"))
  > commit(repo, "Add DESCRIPTION file")
  [5b0e426] 2024-03-23: Add DESCRIPTION file
  > 
  > ## Create R file
  > writeLines("f <- function(x, y) x+y",
  +            con = file.path(path, "bundle", "R", "bundle.R"))
  > add(repo, file.path(path, "bundle", "R", "bundle.R"))
  > commit(repo, "Add R file")
  [7c5ebde] 2024-03-23: Add R file
  > 
  > ## Bundle package
  > bundle_r_package(repo)
  cloning into 'D:/temp/RtmpOixb67/git2r-22b2c57c2d67/bundle/inst/bundle.git'...
  > 
  > ## Fails if bundled package exists
  > tools::assertError(bundle_r_package(repo))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.18    0.21    0.39 
Running the tests in 'tests/checkout-named-branch.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library(git2r)
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create directories for repositories in tempdir
  > path_bare <- tempfile(pattern = "git2r-")
  > path_repo_1 <- tempfile(pattern = "git2r-")
  > path_repo_2 <- tempfile(pattern = "git2r-")
  > 
  > dir.create(path_bare)
  > dir.create(path_repo_1)
  > dir.create(path_repo_2)
  > 
  > ## Create bare repository
  > bare_repo <- init(path_bare, bare = TRUE)
  > 
  > ## Clone to repo 1
  > repo_1 <- clone(path_bare, path_repo_1)
  cloning into 'D:\temp\Rtmpg50Ixj\git2r-47a4647c6be1'...
  > config(repo_1, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Add changes to repo 1 and push to bare
  > writeLines(
  +     "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
  +     con = file.path(path_repo_1, "test.txt"))
  > add(repo_1, "test.txt")
  > commit(repo_1, "First commit message")
  [31d2cb7] 2024-03-23: First commit message
  > branch_name <- branches(repo_1)[[1]]$name
  > push(repo_1, "origin", paste0("refs/heads/", branch_name))
  > 
  > ## Test checkout branch argument
  > tools::assertError(checkout(repo_1))
  > tools::assertError(checkout(repo_1, c("master", "master")))
  > tools::assertError(checkout(repo_1, "dev"))
  > 
  > ## Create and checkout dev branch in repo 1
  > checkout(repo_1, "dev", create = TRUE)
  > 
  > ## Add changes to dev branch in repo 1 and push to bare
  > writeLines(
  +     c("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
  +       "eiusmod tempor incididunt ut labore et dolore magna aliqua."),
  +     con = file.path(path_repo_1, "test.txt"))
  > add(repo_1, "test.txt")
  > commit(repo_1, "Second commit message")
  [34fd2f4] 2024-03-23: Second commit message
  > push(repo_1, "origin", "refs/heads/dev")
  > 
  > ## Clone to repo 2
  > repo_2 <- clone(path_bare, path_repo_2)
  cloning into 'D:\temp\Rtmpg50Ixj\git2r-47a461c27c9e'...
  > config(repo_2, user.name = "Bob", user.email = "bob@example.org")
  > 
  > stopifnot(identical(
  +     "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
  +     readLines(file.path(path_repo_2, "test.txt"))))
  > 
  > ## Checkout dev branch
  > checkout(repo_2, "dev")
  > 
  > ## Check content of file
  > stopifnot(identical(
  +     c("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
  +       "eiusmod tempor incididunt ut labore et dolore magna aliqua."),
  +     readLines(file.path(path_repo_2, "test.txt"))))
  > 
  > ## Checkout previous branch
  > checkout(repo_2, "-")
  > stopifnot(identical(repository_head(repo_2)$name, branch_name))
  > 
  > ## Cleanup
  > unlink(path_bare, recursive = TRUE)
  > unlink(path_repo_1, recursive = TRUE)
  > unlink(path_repo_2, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.26    0.25    0.50 
Running the tests in 'tests/checkout_branch.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library(git2r)
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path, branch = "main")
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create first commit
  > writeLines("Hello world!", file.path(path, "test-1.txt"))
  > add(repo, "test-1.txt")
  > commit(repo, "First commit message")
  [7627567] 2024-03-23: First commit message
  > 
  > ## Create and checkout dev branch in repo
  > checkout(repo, "dev", create = TRUE)
  > 
  > ## Create second commit
  > writeLines(c("Hello world!", "HELLO WORLD!"), file.path(path, "test-2.txt"))
  > add(repo, "test-2.txt")
  > commit(repo, "Second commit message")
  [269f3f9] 2024-03-23: Second commit message
  > 
  > ## Check files
  > stopifnot(identical(list.files(path), c("test-1.txt", "test-2.txt")))
  > 
  > ## Checkout master branch and check files
  > checkout(repo, "main")
  > stopifnot(identical(list.files(path), "test-1.txt"))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > ## Checkout branch in empty repository
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create and checkout dev branch in repo
  > checkout(repo, "dev", create = TRUE)
  > 
  > ## Create first commit
  > writeLines("Hello world!", file.path(path, "test-1.txt"))
  > add(repo, "test-1.txt")
  > commit(repo, "First commit message")
  [7627567] 2024-03-23: First commit message
  > 
  > stopifnot(identical(length(branches(repo)), 1L))
  > stopifnot(identical(branches(repo)[[1]]$name, "dev"))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.25    0.15    0.37 
Running the tests in 'tests/commits_path.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library(git2r)
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path, branch = "main")
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create two files and alternate commits
  > writeLines("1", file.path(path, "odd.txt"))
  > add(repo, "odd.txt")
  > c1 <- commit(repo, "commit 1")
  > 
  > writeLines("2", file.path(path, "even.txt"))
  > add(repo, "even.txt")
  > c2 <- commit(repo, "commit 2")
  > 
  > writeLines("3", file.path(path, "odd.txt"))
  > add(repo, "odd.txt")
  > c3 <- commit(repo, "commit 3")
  > 
  > writeLines("4", file.path(path, "even.txt"))
  > add(repo, "even.txt")
  > c4 <- commit(repo, "commit 4")
  > 
  > writeLines("5", file.path(path, "odd.txt"))
  > add(repo, "odd.txt")
  > c5 <- commit(repo, "commit 5")
  > 
  > writeLines("6", file.path(path, "even.txt"))
  > add(repo, "even.txt")
  > c6 <- commit(repo, "commit 6")
  > 
  > commits_all <- commits(repo)
  > stopifnot(length(commits_all) == 6)
  > 
  > ## Test path
  > commits_odd <- commits(repo, path = "odd.txt")
  > stopifnot(length(commits_odd) == 3)
  > stopifnot(commits_odd[[1]]$sha == c5$sha)
  > stopifnot(commits_odd[[2]]$sha == c3$sha)
  > stopifnot(commits_odd[[3]]$sha == c1$sha)
  > 
  > commits_even <- commits(repo, path = "even.txt")
  > stopifnot(length(commits_even) == 3)
  > stopifnot(commits_even[[1]]$sha == c6$sha)
  > stopifnot(commits_even[[2]]$sha == c4$sha)
  > stopifnot(commits_even[[3]]$sha == c2$sha)
  > 
  > ## Test reverse
  > commits_odd_rev <- commits(repo, reverse = TRUE, path = "odd.txt")
  > stopifnot(length(commits_odd_rev) == 3)
  > stopifnot(commits_odd_rev[[1]]$sha == c1$sha)
  > stopifnot(commits_odd_rev[[2]]$sha == c3$sha)
  > stopifnot(commits_odd_rev[[3]]$sha == c5$sha)
  > 
  > commits_even_rev <- commits(repo, reverse = TRUE, path = "even.txt")
  > stopifnot(length(commits_even_rev) == 3)
  > stopifnot(commits_even_rev[[1]]$sha == c2$sha)
  > stopifnot(commits_even_rev[[2]]$sha == c4$sha)
  > stopifnot(commits_even_rev[[3]]$sha == c6$sha)
  > 
  > ## Test n
  > commits_odd_n <- commits(repo, n = 2, path = "odd.txt")
  > stopifnot(length(commits_odd_n) == 2)
  > stopifnot(commits_odd_n[[1]]$sha == c5$sha)
  > stopifnot(commits_odd_n[[2]]$sha == c3$sha)
  > 
  > commits_even_n <- commits(repo, n = 2, path = "even.txt")
  > stopifnot(length(commits_even_n) == 2)
  > stopifnot(commits_even_n[[1]]$sha == c6$sha)
  > stopifnot(commits_even_n[[2]]$sha == c4$sha)
  > 
  > commits_odd_0 <- commits(repo, n = 0, path = "odd.txt")
  > stopifnot(length(commits_odd_0) == 0)
  > stopifnot(identical(commits_odd_0, list()))
  > 
  > commits_even_0 <- commits(repo, n = 0, path = "even.txt")
  > stopifnot(length(commits_even_0) == 0)
  > stopifnot(identical(commits_even_0, list()))
  > 
  > ## Test ref
  > checkout(repo, branch = "test-ref", create = TRUE)
  > 
  > writeLines("7", file.path(path, "odd.txt"))
  > add(repo, "odd.txt")
  > c7 <- commit(repo, "commit 7")
  > 
  > writeLines("8", file.path(path, "even.txt"))
  > add(repo, "even.txt")
  > c8 <- commit(repo, "commit 8")
  > 
  > commits_odd_ref <- commits(repo, ref = "main", path = "odd.txt")
  > stopifnot(length(commits_odd_ref) == 3)
  > stopifnot(commits_odd_ref[[1]]$sha == c5$sha)
  > stopifnot(commits_odd_ref[[2]]$sha == c3$sha)
  > stopifnot(commits_odd_ref[[3]]$sha == c1$sha)
  > 
  > commits_even_ref <- commits(repo, ref = "main", path = "even.txt")
  > stopifnot(length(commits_even_ref) == 3)
  > stopifnot(commits_even_ref[[1]]$sha == c6$sha)
  > stopifnot(commits_even_ref[[2]]$sha == c4$sha)
  > stopifnot(commits_even_ref[[3]]$sha == c2$sha)
  > 
  > checkout(repo, branch = "main")
  > 
  > ## Test renaming a file (path does not support --follow)
  > writeLines("a file to be renamed", file.path(path, "original.txt"))
  > add(repo, "original.txt")
  > c_original <- commit(repo, "commit original")
  > 
  > commits_original <- commits(repo, path = "original.txt")
  > stopifnot(length(commits_original) == 1)
  > stopifnot(commits_original[[1]]$sha == c_original$sha)
  > 
  > file.rename(file.path(path, "original.txt"), file.path(path, "new.txt"))
  [1] TRUE
  > add(repo, c("original.txt", "new.txt"))
  > c_new <- commit(repo, "commit new")
  > 
  > commits_new <- commits(repo, path = "new.txt")
  > stopifnot(length(commits_new) == 1)
  > stopifnot(commits_new[[1]]$sha == c_new$sha)
  > 
  > ## Test merge commits
  > writeLines(letters[1:5], file.path(path, "merge.txt"))
  > add(repo, "merge.txt")
  > c_merge_1 <- commit(repo, "commit merge 1")
  > 
  > checkout(repo, branch = "test-merge", create = TRUE)
  > cat("z", file = file.path(path, "merge.txt"), append = TRUE)
  > add(repo, "merge.txt")
  > c_merge_2 <- commit(repo, "commit merge 2")
  > 
  > checkout(repo, branch = "main")
  > writeLines(c("A", letters[2:5]), file.path(path, "merge.txt"))
  > add(repo, "merge.txt")
  > c_merge_3 <- commit(repo, "commit merge 3")
  > 
  > c_merge_4 <- merge(repo, "test-merge")
  > stopifnot(class(c_merge_4) == "git_merge_result")
  > 
  > commits_merge <- commits(repo, path = "merge.txt")
  > stopifnot(length(commits_merge) == 4)
  > stopifnot(commits_merge[[1]]$sha == c_merge_4$sha)
  > stopifnot(commits_merge[[2]]$sha == c_merge_3$sha)
  > stopifnot(commits_merge[[3]]$sha == c_merge_2$sha)
  > stopifnot(commits_merge[[4]]$sha == c_merge_1$sha)
  > 
  > ## Test absolute path
  > writeLines("absolute", file.path(path, "abs.txt"))
  > add(repo, "abs.txt")
  > c_abs <- commit(repo, "commit absolute")
  > 
  > commits_abs <- commits(repo, path = file.path(path, "abs.txt"))
  > stopifnot(length(commits_abs) == 1)
  > stopifnot(commits_abs[[1]]$sha == c_abs$sha)
  > 
  > ## Test topological and time
  > ## Strategy:
  > ##   - Commit a new file test-time.txt
  > ##   - Commit a change on branch test-time-1 (a)
  > ##   - Commit a change on branch test-time-2 (c)
  > ##   - Commit a change on branch test-time-1 (b)
  > ##   - Commit a change on branch test-time-2 (d)
  > ##   - Merge branch test-time-2 into main (fast-forward)
  > ##   - Merge branch test-time-1 into main (merge commit)
  > ##
  > ## $ git log --all --decorate --oneline --graph -n 6
  > ## *   79e6880 (HEAD -> main) merge test-time-1
  > ## |\
  > ## | * e2f18f1 (test-time-1) commit b
  > ## | * 5f34820 commit a
  > ## * | b954ec9 (test-time-2) commit d
  > ## * | 7ae2fd5 commit c
  > ## |/
  > ## * 923f3ea commit base
  > Sys.sleep(1)
  > writeLines(as.character(1:100), file.path(path, "test-time.txt"))
  > add(repo, "test-time.txt")
  > c_base <- commit(repo, "commit base")
  > Sys.sleep(1)
  > branch_create(commit = c_base, name = "test-time-1")
  > branch_create(commit = c_base, name = "test-time-2")
  > 
  > checkout(repo, branch = "test-time-1")
  > writeLines(c("edit", 2:100), file.path(path, "test-time.txt"))
  > add(repo, "test-time.txt")
  > c_a <- commit(repo, "commit a")
  > Sys.sleep(1)
  > 
  > checkout(repo, branch = "test-time-2")
  > writeLines(c(1:25, "edit", 27:100), file.path(path, "test-time.txt"))
  > add(repo, "test-time.txt")
  > c_c <- commit(repo, "commit c")
  > Sys.sleep(1)
  > 
  > checkout(repo, branch = "test-time-1")
  > writeLines(c(1:50, "edit", 52:100), file.path(path, "test-time.txt"))
  > add(repo, "test-time.txt")
  > c_b <- commit(repo, "commit b")
  > Sys.sleep(1)
  > 
  > checkout(repo, branch = "test-time-2")
  > writeLines(c(1:75, "edit", 77:100), file.path(path, "test-time.txt"))
  > add(repo, "test-time.txt")
  > c_d <- commit(repo, "commit d")
  > Sys.sleep(1)
  > 
  > checkout(repo, branch = "main")
  > merge(repo, "test-time-2") # Fast-forward
  Merge: Fast-forward
  > merge(repo, "test-time-1") # Merge commit
  Merge
  > c_merge_time <- commits(repo, n = 1)[[1]]
  > 
  > ## topological - commits in test-time-2 come first because it was
  > ## merged first
  > stopifnot(identical(
  +     commits(repo, topological = TRUE, time = FALSE, path = "test-time.txt"),
  +     list(c_merge_time, c_b, c_a, c_d, c_c, c_base)
  + ))
  > stopifnot(identical(
  +     commits(repo, topological = TRUE, time = FALSE, path = "test-time.txt"),
  +     commits(repo, topological = TRUE, time = FALSE)[1:6]
  + ))
  > 
  > ## time - commits ordered by time they were created, not merged into
  > ## main
  > stopifnot(identical(
  +     commits(repo, topological = FALSE, time = TRUE, path = "test-time.txt"),
  +     list(c_merge_time, c_d, c_b, c_c, c_a, c_base)
  + ))
  > stopifnot(identical(
  +     commits(repo, topological = FALSE, time = TRUE, path = "test-time.txt"),
  +     commits(repo, topological = FALSE, time = TRUE)[1:6]
  + ))
  > 
  > ## topological and time - dominated by time
  > stopifnot(identical(
  +     commits(repo, topological = TRUE, time = TRUE, path = "test-time.txt"),
  +     list(c_merge_time, c_d, c_b, c_c, c_a, c_base)
  + ))
  > stopifnot(identical(
  +     commits(repo, topological = TRUE, time = TRUE, path = "test-time.txt"),
  +     commits(repo, topological = TRUE, time = TRUE)[1:6]
  + ))
  > 
  > ## reverse with topological and/or time
  > stopifnot(identical(
  +     commits(repo, topological = TRUE, time = FALSE, reverse = TRUE,
  +             path = "test-time.txt"),
  +     rev(list(c_merge_time, c_b, c_a, c_d, c_c, c_base))
  + ))
  > stopifnot(identical(
  +     commits(repo, topological = FALSE, time = TRUE, reverse = TRUE,
  +             path = "test-time.txt"),
  +     rev(list(c_merge_time, c_d, c_b, c_c, c_a, c_base))
  + ))
  > stopifnot(identical(
  +     commits(repo, topological = TRUE, time = TRUE, reverse = TRUE,
  +             path = "test-time.txt"),
  +     rev(list(c_merge_time, c_d, c_b, c_c, c_a, c_base))
  + ))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.54    0.45    7.15 
Running the tests in 'tests/config.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > 
  > ## Config repository
  > cfg <- config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Check configuration
  > stopifnot(identical(print(cfg), cfg))
  global:
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
          credential.helper=cache
  local:
          core.bare=false
          core.filemode=false
          core.ignorecase=true
          core.logallrefupdates=true
          core.repositoryformatversion=0
          core.symlinks=false
          user.email=alice@example.org
          user.name=Alice
  > stopifnot("local" %in% names(cfg))
  > stopifnot("user.name" %in% names(cfg$local))
  > stopifnot(identical(cfg$local$user.name, "Alice"))
  > stopifnot(identical(cfg$local$user.email, "alice@example.org"))
  > 
  > ## Check that config fails for non-character entry.
  > tools::assertError(config(repo, test = 5))
  > 
  > ## Check config method with missing repo argument
  > wd <- setwd(path)
  > cfg <- config(user.name = "Alice", user.email = "alice@example.org")
  > stopifnot("local" %in% names(cfg))
  > stopifnot("user.name" %in% names(cfg$local))
  > stopifnot(identical(cfg$local$user.name, "Alice"))
  > stopifnot(identical(cfg$local$user.email, "alice@example.org"))
  > stopifnot(identical(git_config_files(repo = repo)$local,
  +                     git_config_files(repo = NULL)$local))
  > stopifnot(identical(git_config_files(repo = repo)$local,
  +                     git_config_files(repo = repo$path)$local))
  > if (!is.null(wd))
  +     setwd(wd)
  > 
  > ## Delete entries
  > cfg <- config(repo, user.name = NULL, user.email = NULL)
  > 
  > ## Check configuration
  > stopifnot(is.null(cfg$local$user.name))
  > stopifnot(is.null(cfg$local$user.email))
  > 
  > ## Supply values as objects
  > user_name <- "Alice"
  > user_email <- "alice@example.org"
  > cfg <- config(repo, user.name = user_name, user.email = "alice@example.org")
  > stopifnot(identical(cfg$local$user.name, user_name))
  > stopifnot(identical(cfg$local$user.email, "alice@example.org"))
  > cfg <- config(repo, user.name = "Alice", user.email = user_email)
  > stopifnot(identical(cfg$local$user.name, "Alice"))
  > stopifnot(identical(cfg$local$user.email, user_email))
  > 
  > ## Check git config files
  > cfg <- git_config_files(repo)
  > stopifnot(identical(nrow(cfg), 4L))
  > stopifnot(identical(names(cfg), c("file", "path")))
  > stopifnot(identical(cfg$file, c("system", "xdg", "global", "local")))
  > stopifnot(!is.na(cfg$path[4]))
  > 
  > ## Check that the local config file is NA for an invalid repo
  > ## argument.
  > stopifnot(is.na(git_config_files(5)$local))
  > 
  > ## Check location of .gitconfig on Windows
  > if (identical(Sys.getenv("APPVEYOR"), "True")) {
  + 
  +   ## AppVeyor diagnostics
  +   str(Sys.getenv("USERPROFILE"))
  +   str(Sys.getenv("HOMEDRIVE"))
  +   str(normalizePath("~"))
  +   str(git_config_files())
  + 
  +   ## Temporarily move AppVeyor .gitconfig
  +   gitconfig_appveyor <- "C:/Users/appveyor/.gitconfig"
  +   gitconfig_tmp <- file.path(tempdir(), ".gitconfig")
  +   file.rename(gitconfig_appveyor, gitconfig_tmp)
  + 
  +   ## Test config() on Windows
  +   gitconfig_expected <- file.path(Sys.getenv("USERPROFILE"), ".gitconfig")
  +   ## .gitconfig should not be created if no configuration options specified
  +   config(global = TRUE)
  +   stopifnot(!file.exists(gitconfig_expected))
  +   ## .gitconfig should be created in the user's home directory
  +   config(global = TRUE, user.name = "name", user.email = "email")
  +   stopifnot(file.exists(gitconfig_expected))
  +   unlink(gitconfig_expected)
  +   ## .gitconfig should be created if user specifies option other than user.name
  +   ## and user.email
  +   config(global = TRUE, core.editor = "nano")
  +   stopifnot(file.exists(gitconfig_expected))
  +   unlink(gitconfig_expected)
  +   ## .gitconfig should not create a new .gitconfig if the user already has one
  +   ## in Documents/
  +   gitconfig_documents <- "~/.gitconfig"
  +   file.create(gitconfig_documents)
  +   config(global = TRUE, core.editor = "nano")
  +   stopifnot(!file.exists(gitconfig_expected))
  +   unlink(gitconfig_documents)
  + 
  +   ## Return AppVeyor .gitconfig
  +   file.rename(gitconfig_tmp, gitconfig_appveyor)
  + }
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.31    0.06    0.34 
Running the tests in 'tests/diff.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create a file, add, commit
  > writeLines("Hello world!", file.path(path, "test.txt"))
  > add(repo, "test.txt")
  > commit(repo, "Commit message")
  [b4179f8] 2024-03-23: Commit message
  > 
  > ## Change the file, diff between index and workdir
  > writeLines("Hello again!\nHere is a second line\nAnd a third",
  +            file.path(path, "test.txt"))
  > diff_1 <- diff(repo)
  > diff(repo, as_char = TRUE)
  [1] "diff --git a/test.txt b/test.txt\nindex dfd6895..0055243 100644\n--- a/test.txt\n+++ b/test.txt\n@@ -1 +1,3 @@\n-Hello world!\r\n+Hello again!\r\n+Here is a second line\r\n+And a third\r\n"
  > diff(repo, as_char = TRUE, filename = file.path(path, "test.diff"))
  NULL
  > 
  > stopifnot(identical(diff_1$old, "index"))
  > stopifnot(identical(diff_1$new, "workdir"))
  > stopifnot(identical(length(diff_1$files), 1L))
  > stopifnot(identical(diff_1$files[[1]]$old_file, "test.txt"))
  > stopifnot(identical(diff_1$files[[1]]$new_file, "test.txt"))
  > stopifnot(identical(length(diff_1$files[[1]]$hunks), 1L))
  > stopifnot(identical(length(diff_1$files[[1]]$hunks[[1]]$lines), 4L))
  > ## TODO: check actual diff
  > 
  > ## Diff between index and HEAD is empty
  > diff_2 <- diff(repo, index = TRUE)
  > diff(repo, as_char = TRUE)
  [1] "diff --git a/test.txt b/test.txt\nindex dfd6895..0055243 100644\n--- a/test.txt\n+++ b/test.txt\n@@ -1 +1,3 @@\n-Hello world!\r\n+Hello again!\r\n+Here is a second line\r\n+And a third\r\n"
  > diff(repo, as_char = TRUE, filename = file.path(path, "test.diff"))
  NULL
  > 
  > stopifnot(identical(diff_2$old, "HEAD"))
  > stopifnot(identical(diff_2$new, "index"))
  > stopifnot(identical(diff_2$files, list()))
  > 
  > ## Diff between tree and working dir, same as diff_1
  > diff_3 <- diff(tree(commits(repo)[[1]]))
  > diff(repo, as_char = TRUE)
  [1] "diff --git a/test.txt b/test.txt\nindex dfd6895..0055243 100644\n--- a/test.txt\n+++ b/test.txt\n@@ -1 +1,3 @@\n-Hello world!\r\n+Hello again!\r\n+Here is a second line\r\n+And a third\r\n"
  > diff(repo, as_char = TRUE, filename = file.path(path, "test.diff"))
  NULL
  > 
  > stopifnot(identical(diff_3$old, tree(commits(repo)[[1]])))
  > stopifnot(identical(diff_3$new, "workdir"))
  > stopifnot(identical(diff_3$files, diff_1$files))
  > stopifnot(identical(print(diff_3), diff_3))
  Old:  tree: 1021ec8da99758dbb8dfc8edb2a12a2c5bcc39dd
  
      mode type                                      sha     name
  1 100644 blob dfd68952a9ba420d898d4e3a666256e8f3a20602 test.txt
  New:  workdir 
  > 
  > ## Add changes, diff between index and HEAD is the same as diff_1
  > add(repo, "test.txt")
  > diff_4 <- diff(repo, index = TRUE)
  > diff(repo, as_char = TRUE)
  [1] ""
  > diff(repo, as_char = TRUE, filename = file.path(path, "test.diff"))
  NULL
  > 
  > stopifnot(identical(diff_4$old, "HEAD"))
  > stopifnot(identical(diff_4$new, "index"))
  > stopifnot(identical(diff_4$files, diff_1$files))
  > 
  > ## Diff between tree and index
  > diff_5 <- diff(tree(commits(repo)[[1]]), index = TRUE)
  > diff(repo, as_char = TRUE)
  [1] ""
  > diff(repo, as_char = TRUE, filename = file.path(path, "test.diff"))
  NULL
  > 
  > stopifnot(identical(diff_5$old, tree(commits(repo)[[1]])))
  > stopifnot(identical(diff_5$new, "index"))
  > stopifnot(identical(diff_5$files, diff_1$files))
  > 
  > ## Diff between two trees
  > commit(repo, "Second commit")
  [49ebfaf] 2024-03-23: Second commit
  > tree_1 <- tree(commits(repo)[[2]])
  > tree_2 <- tree(commits(repo)[[1]])
  > diff_6 <- diff(tree_1, tree_2)
  > diff(repo, as_char = TRUE)
  [1] ""
  > diff(repo, as_char = TRUE, filename = file.path(path, "test.diff"))
  NULL
  > 
  > stopifnot(identical(diff_6$old, tree_1))
  > stopifnot(identical(diff_6$new, tree_2))
  > stopifnot(identical(diff_6$files, diff_1$files))
  > 
  > ## Length of a diff
  > stopifnot(identical(length(diff_1), 1L))
  > stopifnot(identical(length(diff_2), 0L))
  > stopifnot(identical(length(diff_3), 1L))
  > stopifnot(identical(length(diff_4), 1L))
  > stopifnot(identical(length(diff_5), 1L))
  > stopifnot(identical(length(diff_6), 1L))
  > 
  > ## Binary files
  > set.seed(42)
  > writeBin(as.raw((sample(0:255, 1000, replace = TRUE))),
  +          con = file.path(path, "test.bin"))
  > add(repo, "test.bin")
  > diff_7 <- diff(repo, index = TRUE)
  > diff(repo, as_char = TRUE)
  [1] ""
  > diff(repo, as_char = TRUE, filename = file.path(path, "test.diff"))
  NULL
  > 
  > stopifnot(any(grepl("binary file", capture.output(summary(diff_7)))))
  > 
  > ## TODO: errors
  > ## Check non-logical index argument
  > res <- tools::assertError(
  +                   .Call(git2r:::git2r_diff, NULL, NULL, NULL, "FALSE",
  +                         NULL, 3L, 0L, "a", "b", NULL, NULL, NULL))
  > stopifnot(length(grep(paste0("Error in 'git2r_diff': 'index' must be logical ",
  +                              "vector of length one with non NA value\n"),
  +                       res[[1]]$message)) > 0)
  > 
  > ## Check various combinations of diff arguments
  > res <- tools::assertError(
  +                   .Call(git2r:::git2r_diff, NULL, NULL,
  +                         tree(commits(repo)[[1]]),
  +                         FALSE, NULL, 3L, 0L, "a", "b", NULL, NULL, NULL))
  > stopifnot(length(grep("Error in 'git2r_diff': Invalid diff parameters",
  +                       res[[1]]$message)) > 0)
  > 
  > res <- tools::assertError(
  +                   .Call(git2r:::git2r_diff, NULL, NULL,
  +                         tree(commits(repo)[[1]]),
  +                         TRUE, NULL, 3L, 0L, "a", "b", NULL, NULL, NULL))
  > stopifnot(length(grep("Error in 'git2r_diff': Invalid diff parameters",
  +                       res[[1]]$message)) > 0)
  > 
  > res <- tools::assertError(
  +                   .Call(git2r:::git2r_diff, repo, tree(commits(repo)[[1]]),
  +                         NULL, FALSE, NULL, 3L, 0L, "a", "b", NULL, NULL, NULL))
  > stopifnot(length(grep("Error in 'git2r_diff': Invalid diff parameters",
  +                       res[[1]]$message)) > 0)
  > 
  > res <- tools::assertError(
  +                   .Call(git2r:::git2r_diff, repo, tree(commits(repo)[[1]]),
  +                         NULL, TRUE, NULL, 3L, 0L, "a", "b", NULL, NULL, NULL))
  > stopifnot(length(grep("Error in 'git2r_diff': Invalid diff parameters",
  +                       res[[1]]$message)) > 0)
  > 
  > res <- tools::assertError(
  +                   .Call(git2r:::git2r_diff, repo, tree(commits(repo)[[1]]),
  +                         tree(commits(repo)[[2]]), FALSE, NULL, 3L, 0L, "a",
  +                         "b", NULL, NULL, NULL))
  > stopifnot(length(grep("Error in 'git2r_diff': Invalid diff parameters",
  +                       res[[1]]$message)) > 0)
  > 
  > res <- tools::assertError(
  +                   .Call(git2r:::git2r_diff, repo, tree(commits(repo)[[1]]),
  +                         tree(commits(repo)[[2]]), TRUE, NULL, 3L, 0L, "a",
  +                         "b", NULL, NULL, NULL))
  > stopifnot(length(grep("Error in 'git2r_diff': Invalid diff parameters",
  +                       res[[1]]$message)) > 0)
  > 
  > ## TODO: printing
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.29    0.25    0.53 
Running the tests in 'tests/index.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library(git2r)
  > source("util/check.R")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create directories
  > dir.create(file.path(path, "sub-folder"));
  > dir.create(file.path(path, "sub-folder", "sub-sub-folder"));
  > 
  > ## Create files
  > writeLines("Hello world!",
  +            file.path(path, "file-1.txt"))
  > writeLines("Hello world!",
  +            file.path(path, "sub-folder", "file-2.txt"))
  > writeLines("Hello world!",
  +            file.path(path, "sub-folder", "file-3.txt"))
  > writeLines("Hello world!",
  +            file.path(path, "sub-folder", "sub-sub-folder", "file-4.txt"))
  > writeLines("Hello world!",
  +            file.path(path, "sub-folder", "sub-sub-folder", "file-5.txt"))
  > 
  > ## Add
  > add(repo, "file-1.txt")
  > status_exp <- structure(list(staged = list(new = "file-1.txt"),
  +                              unstaged = empty_named_list(),
  +                              untracked = list(untracked = "sub-folder/")),
  +                         class = "git_status")
  > status_obs <- status(repo)
  > stopifnot(identical(status_obs, status_exp))
  > 
  > ## Index remove by path
  > index_remove_bypath(repo, "file-1.txt")
  > status_exp <- structure(list(staged = empty_named_list(),
  +                              unstaged = empty_named_list(),
  +                              untracked = list(untracked = "file-1.txt",
  +                                               untracked = "sub-folder/")),
  +                         class = "git_status")
  > status_obs <- status(repo)
  > stopifnot(identical(status_obs, status_exp))
  > 
  > ## Add
  > add(repo, "sub-folder")
  > status_exp <- structure(list(staged = list(
  +                                  new = "sub-folder/file-2.txt",
  +                                  new = "sub-folder/file-3.txt",
  +                                  new = "sub-folder/sub-sub-folder/file-4.txt",
  +                                  new = "sub-folder/sub-sub-folder/file-5.txt"),
  +                              unstaged = empty_named_list(),
  +                              untracked = list(untracked = "file-1.txt")),
  +                         class = "git_status")
  > status_obs <- status(repo)
  > stopifnot(identical(status_obs, status_exp))
  > 
  > ## Commit
  > commit(repo, "First commit message")
  [9319acd] 2024-03-23: First commit message
  > 
  > ## It should fail to remove non-existing, untracked and ignored files
  > tools::assertError(rm_file(repo, c("file-1.txt", "file-2.txt")))
  > tools::assertError(rm_file(repo, c("file-1.txt", "")))
  > tools::assertError(rm_file(repo, c("file-1.txt")))
  > writeLines("/file-1.txt", file.path(path, ".gitignore"))
  > tools::assertError(rm_file(repo, "file-1.txt"))
  > 
  > ## It should fail to remove files with staged changes
  > file.remove(file.path(path, ".gitignore"))
  [1] TRUE
  > add(repo, "file-1.txt")
  > tools::assertError(rm_file(repo, "file-1.txt"))
  > 
  > ## It should fail to remove files with unstaged changes
  > commit(repo, "Second commit message")
  [b3c4934] 2024-03-23: Second commit message
  > writeLines(c("Hello world!", "Hello world!"),
  +            file.path(path, "file-1.txt"))
  > tools::assertError(rm_file(repo, "file-1.txt"))
  > 
  > ## Remove file
  > add(repo, "file-1.txt")
  > commit(repo, "Third commit message")
  [56aee66] 2024-03-23: Third commit message
  > rm_file(repo, "file-1.txt")
  > status_exp <- structure(list(staged = list(deleted = "file-1.txt"),
  +                              unstaged = empty_named_list(),
  +                              untracked = empty_named_list()),
  +                         class = "git_status")
  > status_obs <- status(repo)
  > stopifnot(identical(status_obs, status_exp))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.28    0.15    0.42 
Running the tests in 'tests/invalid-conf-var.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > 
  > ## Config repository
  > config(repo, user.name = "Alice")
  > 
  > ## Let's set one valid and one with variable with invalid format
  > res <- tools::assertWarning(config(repo,
  +                                    user.email = "alice@example.org",
  +                                    lol = "wut"))
  > stopifnot(length(grep("Variable was not in a valid format: 'lol'",
  +                       res[[1]]$message)) > 0)
  > 
  > cfg_exp <- structure(list(user.name = "Alice",
  +                           user.email = "alice@example.org",
  +                           "NA" = NULL),
  +                      .Names = c("user.name", "user.email", NA))
  > 
  > cfg_obs <- config(repo)$local
  > cfg_obs <- cfg_obs[c("user.name", "user.email", "lol")]
  > stopifnot(identical(cfg_obs, cfg_exp))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.25    0.03    0.28 
Running the tests in 'tests/libgit2.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > stopifnot(identical(names(libgit2_features()),
  +                     c("threads", "https", "ssh")))
  > 
  > stopifnot(identical(names(libgit2_version()),
  +                     c("major", "minor", "rev")))
  > 
  > tools::assertError(ssl_cert_locations())
  > 
  > if (identical(Sys.getenv("R_COVR"), "true")) {
  +     if (isTRUE(libgit2_features()$https)) {
  +         ## Create a directory in tempdir
  +         path <- tempfile(pattern = "git2r-")
  +         dir.create(path)
  +         stopifnot(is.null(ssl_cert_locations(path = path)))
  +         unlink(path)
  +     }
  + }
  > 
  > proc.time()
     user  system elapsed 
     0.23    0.06    0.28 
Running the tests in 'tests/odb_blobs.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > config(repo, user.name = "Alice", user.email = "alice@@example.org")
  > 
  > ## Create a file, add and commit
  > writeLines("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
  +            con = file.path(path, "test.txt"))
  > add(repo, "test.txt")
  > commit(repo, "Commit message 1")
  [4cdb811] 2024-03-23: Commit message 1
  > 
  > ## Change file and commit
  > writeLines(c("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
  +              "eiusmod tempor incididunt ut labore et dolore magna aliqua."),
  +              con = file.path(path, "test.txt"))
  > add(repo, "test.txt")
  > commit(repo, "Commit message 2")
  [70b35b8] 2024-03-23: Commit message 2
  > 
  > ## Commit same content under different name in a sub-directory
  > dir.create(file.path(path, "sub-directory"))
  > file.copy(file.path(path, "test.txt"),
  +           file.path(path, "sub-directory", "copy.txt"))
  [1] TRUE
  > add(repo, "sub-directory/copy.txt")
  > commit(repo, "Commit message 3")
  [996d7c5] 2024-03-23: Commit message 3
  > 
  > ## List blobs
  > b <- odb_blobs(repo)
  > 
  > ## Order the data.frame before checking
  > b <- b[order(b$name), ]
  > 
  > ## Check blobs
  > stopifnot(identical(nrow(b), 3L))
  > stopifnot(identical(
  +     colnames(b),
  +     c("sha", "path", "name", "len", "commit", "author", "when")))
  > stopifnot(identical(b$path, c("sub-directory", "", "")))
  > stopifnot(identical(b$name, c("copy.txt", "test.txt", "test.txt")))
  > stopifnot(identical(b$author, c("Alice", "Alice", "Alice")))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.28    0.10    0.39 
Running the tests in 'tests/reference.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library(git2r)
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path, branch = "main")
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create a file
  > writeLines("Hello world!", file.path(path, "test.txt"))
  > 
  > ## add and commit
  > add(repo, "test.txt")
  > commit(repo, "Commit message")
  [d60797c] 2024-03-23: Commit message
  > 
  > ## Check dwim of reference shorthand
  > stopifnot(identical(.Call(git2r:::git2r_reference_dwim, repo, "")$name,
  +                     "refs/heads/main"))
  > stopifnot(identical(.Call(git2r:::git2r_reference_dwim, repo, "main")$name,
  +                     "refs/heads/main"))
  > stopifnot(identical(
  +     .Call(git2r:::git2r_reference_dwim, repo, "refs/heads/main")$name,
  +     "refs/heads/main"))
  > 
  > ## print reference
  > r <- .Call(git2r:::git2r_reference_dwim, repo, "refs/heads/main")
  > stopifnot(identical(print(r), r))
  [d60797] main
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.29    0.03    0.31 
Running the tests in 'tests/refspec.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create directories for repositories in tempdir
  > path_bare <- tempfile(pattern = "git2r-")
  > path_repo <- tempfile(pattern = "git2r-")
  > 
  > dir.create(path_bare)
  > dir.create(path_repo)
  > 
  > ## Create bare repository
  > bare_repo <- init(path_bare, bare = TRUE)
  > 
  > ## Clone to repo
  > repo <- clone(path_bare, path_repo)
  cloning into 'D:\temp\Rtmp4sZbcN\git2r-212d85b2f77d1'...
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Add changes to repo
  > writeLines("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
  +            con = file.path(path_repo, "test.txt"))
  > add(repo, "test.txt")
  > commit_1 <- commit(repo, "First commit message")
  > 
  > ## Add more changes to repo
  > writeLines(c("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
  +              "eiusmod tempor incididunt ut labore et dolore magna aliqua."),
  +            con = file.path(path_repo, "test.txt"))
  > add(repo, "test.txt")
  > commit_2 <- commit(repo, "Second commit message")
  > 
  > ## Check remote
  > stopifnot(identical(
  +     git2r:::get_refspec(repo, spec = "master")$remote,
  +     "origin"))
  > 
  > ## Detach
  > checkout(commit_1)
  > tools::assertError(git2r:::get_refspec(repo))
  > 
  > ## Cleanup
  > unlink(path_bare, recursive = TRUE)
  > unlink(path_repo, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.15    0.17    0.32 
Running the tests in 'tests/remotes.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create a file
  > writeLines("Hello world!", file.path(path, "test.txt"))
  > 
  > ## Add and commit
  > add(repo, "test.txt")
  > commit_1 <- commit(repo, "Commit message")
  > 
  > ## Add a remote
  > remote_add(repo, "playground",
  +            "https://github.com/gaborcsardi/playground")
  > 
  > stopifnot(identical(remotes(repo), "playground"))
  > stopifnot(identical(remote_url(repo, "playground"),
  +                     "https://github.com/gaborcsardi/playground"))
  > stopifnot(identical(remote_url(repo),
  +                     "https://github.com/gaborcsardi/playground"))
  > 
  > ## Rename a remote
  > remote_rename(repo, "playground", "foobar")
  > 
  > stopifnot(identical(remotes(repo), "foobar"))
  > stopifnot(identical(remote_url(repo, "foobar"),
  +                     "https://github.com/gaborcsardi/playground"))
  > 
  > ## Set remote url
  > remote_set_url(repo, "foobar", "https://github.com/stewid/playground")
  > stopifnot(identical(remote_url(repo, "foobar"),
  +                     "https://github.com/stewid/playground"))
  > 
  > ## Remove a remote
  > remote_remove(repo, "foobar")
  > 
  > stopifnot(identical(remotes(repo), character(0)))
  > 
  > if (identical(Sys.getenv("NOT_CRAN"), "true")) {
  +     if (isTRUE(libgit2_features()$https)) {
  +         refs <- remote_ls("https://github.com/ropensci/git2r")
  +         stopifnot(length(refs) > 0)
  +         stopifnot(names(refs) > 0)
  +         stopifnot(any(names(refs) == "HEAD"))
  +     }
  + }
  > 
  > # an invalid URL should throw an error
  > tools::assertError(remote_ls("bad"))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.15    0.12    0.26 
Running the tests in 'tests/repository.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library(git2r)
  > source("util/check.R")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## is_bare: "Invalid repository"
  > tools::assertError(is_bare(new("git_repository")))
  > 
  > ## is_empty: "Invalid repository"
  > tools::assertError(is_empty(new("git_repository")))
  > 
  > ## Check that open an invalid repository fails
  > tools::assertError(repository(path))
  > tools::assertError(repository(path, discover = FALSE))
  > 
  > ## Check that it fails to open/init a repository with a path to a
  > ## file.
  > writeLines("test", file.path(path, "test.txt"))
  > tools::assertError(repository(file.path(path, "test.txt"),
  +                               discover = FALSE))
  > tools::assertError(init(file.path(path, "test.txt")))
  > unlink(file.path(path, "test.txt"))
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > stopifnot(identical(print(repo), repo))
  Local:    D:/temp/Rtmpa85yX0/git2r-2d5fc38f12825
  Head:     nothing commited (yet)
  > 
  > ## Check the state of the repository
  > stopifnot(identical(is_bare(repo), FALSE))
  > stopifnot(identical(is_empty(repo), TRUE))
  > stopifnot(identical(is_shallow(repo), FALSE))
  > stopifnot(identical(branches(repo), empty_named_list()))
  > stopifnot(identical(references(repo), empty_named_list()))
  > stopifnot(identical(commits(repo), list()))
  > stopifnot(identical(repository_head(repo), NULL))
  > 
  > # check that we can find repository from a path
  > wd <- sub(paste0("[", .Platform$file.sep, "]$"), "",  workdir(repo))
  > writeLines("test file", con = file.path(wd, "myfile.txt"))
  > stopifnot(identical(discover_repository(file.path(wd, "myfile.txt")),
  +                     file.path(wd, ".git")))
  > stopifnot(identical(discover_repository(file.path(wd, "doesntexist.txt")),
  +                     NULL))
  Warning message:
  In normalizePath(path.expand(path), winslash, mustWork) :
    path[1]="D:/temp/Rtmpa85yX0/git2r-2d5fc38f12825/doesntexist.txt": Das System kann die angegebene Datei nicht finden
  > 
  > # Check that we can use ceiling in discover repostiory
  > dir.create(file.path(wd, "temp"))
  > stopifnot(identical(discover_repository(file.path(wd, "temp"), 0), NULL))
  > stopifnot(identical(discover_repository(file.path(wd, "temp"), 1),
  +                     file.path(wd, ".git")))
  > tools::assertError(discover_repository(file.path(wd, "temp"), 2))
  > 
  > ## Check that lookup with a sha of less than 4 characters or more than
  > ## 40 characters fail.
  > tools::assertError(lookup(repo, paste0(rep("a", 3), collapse = "")))
  > tools::assertError(lookup(repo, paste0(rep("a", 41), collapse = "")))
  > 
  > ## Check in_repository
  > stopifnot(identical(in_repository(path), TRUE))
  > 
  > ## Check:
  > ## - in_repository method with missing path argument
  > ## - repository method with missing path argument
  > ## - workdir method with missing path argument
  > ## - is_empty method with missing repo argument
  > ## - is_shallow method with missing repo argument
  > wd <- setwd(path)
  > stopifnot(identical(in_repository(), TRUE))
  > stopifnot(identical(workdir(repository(path)), workdir(repository())))
  > stopifnot(identical(workdir(repository(path)), workdir()))
  > stopifnot(identical(is_empty(), TRUE))
  > stopifnot(identical(is_shallow(), FALSE))
  > if (!is.null(wd))
  +     setwd(wd)
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.29    0.12    0.37 
Running the tests in 'tests/reset.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library(git2r)
  > source("util/check.R")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create a file
  > writeLines("Hello world!", file.path(path, "test-1.txt"))
  > 
  > ## Add and reset an empty repository using a path
  > add(repo, "test-1.txt")
  > stopifnot(identical(
  +     status(repo),
  +     structure(list(staged = list(new = "test-1.txt"),
  +                    unstaged = empty_named_list(),
  +                    untracked = empty_named_list()),
  +               class = "git_status")))
  > reset(repo, path = "test-1.txt")
  > stopifnot(identical(
  +     status(repo),
  +     structure(list(staged = empty_named_list(),
  +                    unstaged = empty_named_list(),
  +                    untracked = list(untracked = "test-1.txt")),
  +               class = "git_status")))
  > 
  > ## Add and reset a non-empty repository using a path
  > add(repo, "test-1.txt")
  > commit(repo, "First commit")
  [3508341] 2024-03-23: First commit
  > writeLines(c("Hello world!", "HELLO WORLD!"), file.path(path, "test-1.txt"))
  > add(repo, "test-1.txt")
  > stopifnot(identical(
  +     status(repo),
  +     structure(list(staged = list(modified = "test-1.txt"),
  +                    unstaged = empty_named_list(),
  +                    untracked = empty_named_list()),
  +               class = "git_status")))
  > reset(repo, path = "test-1.txt")
  > stopifnot(identical(
  +     status(repo),
  +     structure(list(staged = empty_named_list(),
  +                    unstaged = list(modified = "test-1.txt"),
  +                    untracked = empty_named_list()),
  +               class = "git_status")))
  > 
  > ## add and commit
  > add(repo, "test-1.txt")
  > commit_1 <- commit(repo, "Commit message")
  > 
  > ## Make one more commit
  > writeLines(c("Hello world!", "HELLO WORLD!", "hello world!"),
  +            file.path(path, "test-1.txt"))
  > add(repo, "test-1.txt")
  > commit(repo, "Next commit message")
  [ccf5fcc] 2024-03-23: Next commit message
  > 
  > ## Create one more file
  > writeLines("Hello world!", file.path(path, "test-2.txt"))
  > 
  > ## 'soft' reset to first commit
  > reset(commit_1)
  > soft_exp <- structure(list(staged = list(modified = "test-1.txt"),
  +                            unstaged = empty_named_list(),
  +                            untracked = list(untracked = "test-2.txt")),
  +                       class = "git_status")
  > soft_obs <- status(repo)
  > stopifnot(identical(soft_obs, soft_exp))
  > stopifnot(identical(length(commits(repo)), 2L))
  > stopifnot(identical(commits(repo)[[1]], commit_1))
  > 
  > ## 'mixed' reset to first commit
  > commit(repo, "Next commit message")
  [ccf5fcc] 2024-03-23: Next commit message
  > reset(commit_1, "mixed")
  > mixed_exp <- structure(list(staged = empty_named_list(),
  +                             unstaged = list(modified = "test-1.txt"),
  +                             untracked = list(untracked = "test-2.txt")),
  +                        class = "git_status")
  > mixed_obs <- status(repo)
  > stopifnot(identical(mixed_obs, mixed_exp))
  > stopifnot(identical(length(commits(repo)), 2L))
  > stopifnot(identical(commits(repo)[[1]], commit_1))
  > 
  > ## 'hard' reset to first commit
  > add(repo, "test-1.txt")
  > commit(repo, "Next commit message")
  [ccf5fcc] 2024-03-23: Next commit message
  > reset(commit_1, "hard")
  > hard_exp <- structure(list(staged = empty_named_list(),
  +                            unstaged = empty_named_list(),
  +                            untracked = list(untracked = "test-2.txt")),
  +                       class = "git_status")
  > hard_obs <- status(repo)
  > stopifnot(identical(hard_obs, hard_exp))
  > stopifnot(identical(length(commits(repo)), 2L))
  > stopifnot(identical(commits(repo)[[1]], commit_1))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.29    0.21    0.50 
Running the tests in 'tests/revparse.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Create a directory in tempdir
  > path <- tempfile(pattern = "git2r-")
  > dir.create(path)
  > 
  > ## Initialize a repository
  > repo <- init(path)
  > config(repo, user.name = "Alice", user.email = "alice@example.org")
  > 
  > ## Create a file
  > writeLines("Hello world!", file.path(path, "test.txt"))
  > 
  > ## Add and commit
  > add(repo, "test.txt")
  > commit_1 <- commit(repo, "First commit message")
  > 
  > tools::assertError(revparse_single(repo, "HEAD^"))
  > 
  > ## Add another commit
  > writeLines(c("Hello world!", "HELLO WORLD!"), file.path(path, "test.txt"))
  > add(repo, "test.txt")
  > commit(repo, "Second commit message")
  [a74594f] 2024-03-23: Second commit message
  > 
  > stopifnot(identical(revparse_single(repo, "HEAD^"), commit_1))
  > stopifnot(is_blob(revparse_single(repo, "HEAD:test.txt")))
  > 
  > ## Cleanup
  > unlink(path, recursive = TRUE)
  > 
  > proc.time()
     user  system elapsed 
     0.21    0.09    0.29 
Running the tests in 'tests/signature.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library("git2r")
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Check printing of a class git_signature
  > when <- structure(list(time = 1395567947, offset = 60),
  +                   class = "git_time")
  > 
  > signature <- structure(list(name = "Alice",
  +                             email = "alice@example.org",
  +                             when = when),
  +                        class = "git_signature")
  > stopifnot(identical(print(signature), signature))
  name:  Alice
  email: alice@example.org
  when:  2014-03-23 09:45:47 GMT
  > 
  > proc.time()
     user  system elapsed 
     0.20    0.10    0.25 
Running the tests in 'tests/time.R' failed.
Complete output:
  > ## git2r, R bindings to the libgit2 library.
  > ## Copyright (C) 2013-2023 The git2r contributors
  > ##
  > ## This program is free software; you can redistribute it and/or modify
  > ## it under the terms of the GNU General Public License, version 2,
  > ## as published by the Free Software Foundation.
  > ##
  > ## git2r is distributed in the hope that it will be useful,
  > ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  > ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  > ## GNU General Public License for more details.
  > ##
  > ## You should have received a copy of the GNU General Public License along
  > ## with this program; if not, write to the Free Software Foundation, Inc.,
  > ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  > 
  > library(git2r)
  > 
  > ## For debugging
  > sessionInfo()
  R Under development (unstable) (2024-03-22 r86169 ucrt)
  Platform: x86_64-w64-mingw32/x64
  Running under: Windows Server 2022 x64 (build 20348)
  
  Matrix products: default
  
  
  locale:
  [1] LC_COLLATE=C                 LC_CTYPE=German_Germany.utf8
  [3] LC_MONETARY=C                LC_NUMERIC=C                
  [5] LC_TIME=C                   
  
  time zone: Europe/Berlin
  tzcode source: internal
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] git2r_0.33.0
  
  loaded via a namespace (and not attached):
  [1] compiler_4.4.0
  > libgit2_version()
  $major
  [1] 1
  
  $minor
  [1] 7
  
  $rev
  [1] 2
  
  > libgit2_features()
  $threads
  [1] TRUE
  
  $https
  [1] TRUE
  
  $ssh
  [1] FALSE
  
  > 
  > 
  > ## Test to coerce
  > git_t <- structure(list(time = 1395567947, offset = 60),
  +                    class = "git_time")
  > stopifnot(identical(as.character(git_t), "2014-03-23 09:45:47 GMT"))
  > stopifnot(identical(as.character(git_t, usetz = FALSE), "2014-03-23 09:45:47"))
  > stopifnot(identical(as.POSIXct(git_t),
  +                     as.POSIXct(1395567947, tz = "GMT", origin = "1970-01-01")))
  > stopifnot(identical(print(git_t), git_t))
  2014-03-23 09:45:47 GMT
  > 
  > as.POSIXct(1395567947, origin = "1970-01-01", tz = "-03")
  [1] "2014-03-23 12:45:47"
  Warning message:
  In as.POSIXlt.POSIXct(x, tz) : unknown timezone '-03'
  > 
  > ## Test that origin/tz can be passed to as.POSIXct
  > stopifnot(identical(as.POSIXct(git_t, tz = "Europe/Stockholm",
  +                                origin = "1980-02-02"),
  +                     as.POSIXct(1395567947, tz = "Europe/Stockholm",
  +                                origin = "1980-02-02")))
  > 
  > ## Test that origin/tz can be passed to as.character
  > stopifnot(identical(as.character(git_t, tz = "Europe/Stockholm",
  +                                  origin = "1980-02-02"),
  +                     "2024-04-23 11:45:47 CEST"))
  > stopifnot(identical(as.character(git_t, tz = "Europe/Stockholm",
  +                                  origin = "1980-02-02", usetz = FALSE),
  +                     "2024-04-23 11:45:47"))
  > 
  > ## Test that origin/tz can be passed to print
  > stopifnot(identical(
  +     utils::capture.output(print(git_t, tz = "Europe/Stockholm",
  +                                 origin = "1980-02-02")),
  +     "2024-04-23 11:45:47 CEST"
  + ))
  > stopifnot(identical(
  +     utils::capture.output(print(git_t, tz = "Europe/Stockholm",
  +                                 origin = "1980-02-02", usetz = FALSE)),
  +     "2024-04-23 11:45:47"
  + ))
  > 
  > proc.time()
     user  system elapsed 
     0.28    0.01    0.25