1#' Stashing changes
2#'
3#' Temporary stash away changed from the working directory.
4#'
5#' @export
6#' @rdname git_stash
7#' @name git_stash
8#' @family git
9#' @inheritParams git_open
10#' @useDynLib gert R_git_stash_save
11#' @param message optional message to store the stash
12#' @param keep_index changes already added to the index are left intact in
13#' the working directory
14#' @param include_untracked untracked files are also stashed and then
15#' cleaned up from the working directory
16#' @param include_ignored ignored files are also stashed and then cleaned
17#' up from the working directory
18git_stash_save <- function(message = "", keep_index = FALSE, include_untracked = FALSE,
19                           include_ignored = FALSE, repo = "."){
20  repo <- git_open(repo)
21  keep_index <- as.logical(keep_index)
22  include_untracked <- as.logical(include_untracked)
23  include_ignored <- as.logical(include_ignored)
24  .Call(R_git_stash_save, repo, message, keep_index, include_untracked, include_ignored)
25}
26
27#' @export
28#' @rdname git_stash
29#' @useDynLib gert R_git_stash_pop
30#' @param index The position within the stash list. 0 points to the
31#' most recent stashed state.
32git_stash_pop <- function(index = 0, repo = "."){
33  repo <- git_open(repo)
34  .Call(R_git_stash_pop, repo, index)
35}
36
37#' @export
38#' @rdname git_stash
39#' @useDynLib gert R_git_stash_drop
40git_stash_drop <- function(index = 0, repo = "."){
41  repo <- git_open(repo)
42  .Call(R_git_stash_drop, repo, index)
43}
44
45#' @export
46#' @rdname git_stash
47#' @useDynLib gert R_git_stash_list
48git_stash_list <- function(repo = "."){
49  repo <- git_open(repo)
50  .Call(R_git_stash_list, repo)
51}
52