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

Skip to content

Commit 74b2799

Browse files
committed
Added git_stash_apply() and git_stash_pop() APIs
1 parent 65f6c1c commit 74b2799

4 files changed

Lines changed: 439 additions & 1 deletion

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Microsoft Corporation
4949
Olivier Ramonat
5050
Peter Drahoš
5151
Pierre Habouzit
52+
Pierre-Olivier Latour
5253
Przemyslaw Pawelczyk
5354
Ramsay Jones
5455
Robert G. Jakabosky

include/git2/stash.h

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,24 @@ GIT_EXTERN(int) git_stash_save(
6161
const char *message,
6262
unsigned int flags);
6363

64+
/**
65+
* Apply a single stashed state from the stash list.
66+
*
67+
* @param repo The owning repository.
68+
*
69+
* @param index The position within the stash list. 0 points to the
70+
* most recent stashed state.
71+
*
72+
* @param reinstate_index Try to reinstate not only the working tree's changes,
73+
* but also the index's ones.
74+
*
75+
* @return 0 on success, or error code
76+
*/
77+
GIT_EXTERN(int) git_stash_apply(
78+
git_repository *repo,
79+
size_t index,
80+
int reinstate_index);
81+
6482
/**
6583
* This is a callback function you can provide to iterate over all the
6684
* stashed states that will be invoked per entry.
@@ -107,11 +125,29 @@ GIT_EXTERN(int) git_stash_foreach(
107125
*
108126
* @return 0 on success, or error code
109127
*/
110-
111128
GIT_EXTERN(int) git_stash_drop(
112129
git_repository *repo,
113130
size_t index);
114131

132+
/**
133+
* Apply a single stashed state from the stash list and remove it from the list
134+
* if successful.
135+
*
136+
* @param repo The owning repository.
137+
*
138+
* @param index The position within the stash list. 0 points to the
139+
* most recent stashed state.
140+
*
141+
* @param reinstate_index Try to reinstate not only the working tree's changes,
142+
* but also the index's ones.
143+
*
144+
* @return 0 on success, or error code
145+
*/
146+
GIT_EXTERN(int) git_stash_pop(
147+
git_repository *repo,
148+
size_t index,
149+
int reinstate_index);
150+
115151
/** @} */
116152
GIT_END_DECL
117153
#endif

0 commit comments

Comments
 (0)