diff options
| author | nulltoken <emeric.fermas@gmail.com> | 2012-10-04 13:47:45 +0200 |
|---|---|---|
| committer | nulltoken <emeric.fermas@gmail.com> | 2012-10-26 22:10:48 +0200 |
| commit | 590fb68be087ed8a60323026dc2501c456ede945 (patch) | |
| tree | f89469a36a08eee9ab64512489c81a6d3daf04ae /include | |
| parent | eb44cfe07b16e5680c50c13cee79859455b90803 (diff) | |
| download | libgit2-590fb68be087ed8a60323026dc2501c456ede945.tar.gz | |
stash: add git_stash_save()
Diffstat (limited to 'include')
| -rw-r--r-- | include/git2.h | 1 | ||||
| -rw-r--r-- | include/git2/stash.h | 67 |
2 files changed, 68 insertions, 0 deletions
diff --git a/include/git2.h b/include/git2.h index d55543986..3bb2fce11 100644 --- a/include/git2.h +++ b/include/git2.h @@ -52,5 +52,6 @@ #include "git2/reset.h" #include "git2/message.h" #include "git2/pack.h" +#include "git2/stash.h" #endif diff --git a/include/git2/stash.h b/include/git2/stash.h new file mode 100644 index 000000000..cadc65673 --- /dev/null +++ b/include/git2/stash.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2009-2012 the libgit2 contributors + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_git_stash_h__ +#define INCLUDE_git_stash_h__ + +#include "common.h" +#include "types.h" + +/** + * @file git2/stash.h + * @brief Git stash management routines + * @ingroup Git + * @{ + */ +GIT_BEGIN_DECL + +enum { + GIT_STASH_DEFAULT = 0, + + /* All changes already added to the index + * are left intact in the working directory + */ + GIT_STASH_KEEP_INDEX = (1 << 0), + + /* All untracked files are also stashed and then + * cleaned up from the working directory + */ + GIT_STASH_INCLUDE_UNTRACKED = (1 << 1), + + /* All ignored files are also stashed and then + * cleaned up from the working directory + */ + GIT_STASH_INCLUDE_IGNORED = (1 << 2), +}; + +/** + * Save the local modifications to a new stash. + * + * @param out Object id of the commit containing the stashed state. + * This commit is also the target of the direct reference refs/stash. + * + * @param repo The owning repository. + * + * @param stasher The identity of the person performing the stashing. + * + * @param message Optional description along with the stashed state. + * + * @param flags Flags to control the stashing process. + * + * @return 0 on success, GIT_ENOTFOUND where there's nothing to stash, + * or error code. + */ + +GIT_EXTERN(int) git_stash_save( + git_oid *out, + git_repository *repo, + git_signature *stasher, + const char *message, + uint32_t flags); + +/** @} */ +GIT_END_DECL +#endif |
