Skip to content

Commit ee04266

Browse files
committed
Use last_commit() as default to determine commit in 'branch create'. Closes #417
Signed-off-by: Stefan Widgren <stefan.widgren@gmail.com>
1 parent 48aa485 commit ee04266

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

R/branch.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## git2r, R bindings to the libgit2 library.
2-
## Copyright (C) 2013-2019 The git2r contributors
2+
## Copyright (C) 2013-2020 The git2r contributors
33
##
44
## This program is free software; you can redistribute it and/or modify
55
## it under the terms of the GNU General Public License, version 2,
@@ -16,7 +16,9 @@
1616

1717
##' Create a branch
1818
##'
19-
##' @param commit Commit to which branch should point.
19+
##' @param commit Commit to which the branch should point. The default
20+
##' is to use the \code{last_commit()} function to determine the
21+
##' commit to which the branch should point.
2022
##' @param name Name for the branch
2123
##' @param force Overwrite existing branch. Default = FALSE
2224
##' @return invisible git_branch object
@@ -50,7 +52,8 @@
5052
##' ## Force it
5153
##' branch_2 <- branch_create(commit_2, name = "test-branch", force = TRUE)
5254
##' }
53-
branch_create <- function(commit = NULL, name = NULL, force = FALSE) {
55+
branch_create <- function(commit = last_commit(), name = NULL,
56+
force = FALSE) {
5457
invisible(.Call(git2r_branch_create, name, commit, force))
5558
}
5659

man/branch_create.Rd

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)