8000 stash: partial stash specific files by gitkraken-jacobw · Pull Request #6330 · libgit2/libgit2 · GitHub
[go: up one dir, main page]

Skip to content

stash: partial stash specific files #6330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 60 additions & 6 deletions include/git2/stash.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ typedef enum {
* All ignored files are also stashed and then cleaned up from
* the working directory
*/
GIT_STASH_INCLUDE_IGNORED = (1 << 2)
GIT_STASH_INCLUDE_IGNORED = (1 << 2),

/**
* All changes in the index and working directory are left intact
*/
GIT_STASH_KEEP_ALL = (1 << 3)
} git_st 8000 ash_flags;

/**
* 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. (see GIT_STASH_* above)
*
* @return 0 on success, GIT_ENOTFOUND where there's nothing to stash,
* or error code.
*/
Expand All @@ -71,6 +71,60 @@ GIT_EXTERN(int) git_stash_save(
const char *message,
uint32_t flags);

/**
* Stash save options structure
*
* Initialize with `GIT_STASH_SAVE_OPTIONS_INIT`. Alternatively, you can
* use `git_stash_save_options_init`.
*
*/
typedef struct git_stash_save_options {
unsigned int version;

/** Flags to control the stashing process. (see GIT_STASH_* above) */
uint32_t flags;

/** The identity of the person performing the stashing. */
const git_signature *stasher;

/** Optional description along with the stashed state. */
const char *message;

/** Optional paths that control which files are stashed. */
git_strarray paths;
} git_stash_save_options;

#define GIT_STASH_SAVE_OPTIONS_VERSION 1
#define GIT_STASH_SAVE_OPTIONS_INIT { GIT_STASH_SAVE_OPTIONS_VERSION }

/**
* Initialize git_stash_save_options structure
*
* Initializes a `git_stash_save_options` with default values. Equivalent to
* creating an instance with `GIT_STASH_SAVE_OPTIONS_INIT`.
*
* @param opts The `git_stash_save_options` struct to initialize.
* @param version The struct version; pass `GIT_STASH_SAVE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_stash_save_options_init(
git_stash_save_options *opts, unsigned int version);

/**
* Save the local modifications to a new stash, with options.
*
* @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 opts The stash options.
* @return 0 on success, GIT_ENOTFOUND where there's nothing to stash,
* or error code.
*/
GIT_EXTERN(int) git_stash_save_with_opts(
git_oid *out,
git_repository *repo,
const git_stash_save_options *opts);

/** Stash application flags. */
typedef enum {
GIT_STASH_APPLY_DEFAULT = 0,
Expand Down
Loading
0