Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Provide a git_stash_apply() API #2636

@swisspol

Description

@swisspol

I'm trying to reproduce the behavior of git stash -u followed by git stash apply in libgit2. I can create the stash properly in libgit2 and applying it with the git CLT works. However, if I try to apply it with libgit2, the untracked files are not restored.

git_checkout_options options = GIT_CHECKOUT_OPTIONS_INIT;
  options.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE | GIT_CHECKOUT_DONT_UPDATE_INDEX;
  CALL_LIBGIT2_FUNCTION_RETURN(NO, git_checkout_tree, self.private, (git_object*)stash.private, &options);

(stash.private is actually a git_commit* retrieved with git_commit_lookup() after creating the stash)

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions