]> git.proxmox.com Git - libgit2.git/blame - include/git2/stash.h
Rever spelling fixes for dependencies
[libgit2.git] / include / git2 / stash.h
CommitLineData
590fb68b 1/*
359fc2d2 2 * Copyright (C) the libgit2 contributors. All rights reserved.
590fb68b 3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7#ifndef INCLUDE_git_stash_h__
8#define INCLUDE_git_stash_h__
9
10#include "common.h"
11#include "types.h"
12
13/**
14 * @file git2/stash.h
15 * @brief Git stash management routines
16 * @ingroup Git
17 * @{
18 */
19GIT_BEGIN_DECL
20
1d8ec670 21typedef enum {
590fb68b 22 GIT_STASH_DEFAULT = 0,
23
24 /* All changes already added to the index
25 * are left intact in the working directory
26 */
27 GIT_STASH_KEEP_INDEX = (1 << 0),
28
29 /* All untracked files are also stashed and then
30 * cleaned up from the working directory
31 */
32 GIT_STASH_INCLUDE_UNTRACKED = (1 << 1),
33
34 /* All ignored files are also stashed and then
35 * cleaned up from the working directory
36 */
37 GIT_STASH_INCLUDE_IGNORED = (1 << 2),
1d8ec670 38} git_stash_flags;
590fb68b 39
40/**
41 * Save the local modifications to a new stash.
42 *
43 * @param out Object id of the commit containing the stashed state.
44 * This commit is also the target of the direct reference refs/stash.
45 *
46 * @param repo The owning repository.
47 *
48 * @param stasher The identity of the person performing the stashing.
49 *
50 * @param message Optional description along with the stashed state.
51 *
1d8ec670 52 * @param flags Flags to control the stashing process. (see GIT_STASH_* above)
590fb68b 53 *
54 * @return 0 on success, GIT_ENOTFOUND where there's nothing to stash,
55 * or error code.
56 */
590fb68b 57GIT_EXTERN(int) git_stash_save(
58 git_oid *out,
59 git_repository *repo,
2274993b 60 const git_signature *stasher,
590fb68b 61 const char *message,
1d8ec670 62 unsigned int flags);
590fb68b 63
23388413 64/**
373cf6a9
RB
65 * This is a callback function you can provide to iterate over all the
66 * stashed states that will be invoked per entry.
23388413 67 *
68 * @param index The position within the stash list. 0 points to the
373cf6a9 69 * most recent stashed state.
23388413 70 * @param message The stash message.
1d8ec670 71 * @param stash_id The commit oid of the stashed state.
23388413 72 * @param payload Extra parameter to callback function.
373cf6a9 73 * @return 0 to continue iterating or non-zero to stop
23388413 74 */
1d8ec670 75typedef int (*git_stash_cb)(
23388413 76 size_t index,
77 const char* message,
1d8ec670 78 const git_oid *stash_id,
23388413 79 void *payload);
80
81/**
82 * Loop over all the stashed states and issue a callback for each one.
83 *
84 * If the callback returns a non-zero value, this will stop looping.
85 *
86 * @param repo Repository where to find the stash.
87 *
373cf6a9
RB
88 * @param callback Callback to invoke per found stashed state. The most
89 * recent stash state will be enumerated first.
23388413 90 *
91 * @param payload Extra parameter to callback function.
92 *
373cf6a9 93 * @return 0 on success, non-zero callback return value, or error code
23388413 94 */
95GIT_EXTERN(int) git_stash_foreach(
96 git_repository *repo,
1d8ec670 97 git_stash_cb callback,
23388413 98 void *payload);
99
e4c64cf2 100/**
101 * Remove a single stashed state from the stash list.
102 *
103 * @param repo The owning repository.
104 *
105 * @param index The position within the stash list. 0 points to the
106 * most recent stashed state.
107 *
108 * @return 0 on success, or error code
109 */
110
111GIT_EXTERN(int) git_stash_drop(
112 git_repository *repo,
113 size_t index);
114
590fb68b 115/** @} */
116GIT_END_DECL
117#endif