git/builtin/stash.c

#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
#include "environment.h"
#include "gettext.h"
#include "hash.h"
#include "hex.h"
#include "object-name.h"
#include "parse-options.h"
#include "refs.h"
#include "lockfile.h"
#include "cache-tree.h"
#include "unpack-trees.h"
#include "merge-recursive.h"
#include "merge-ort-wrappers.h"
#include "strvec.h"
#include "run-command.h"
#include "dir.h"
#include "entry.h"
#include "preload-index.h"
#include "read-cache.h"
#include "repository.h"
#include "rerere.h"
#include "revision.h"
#include "setup.h"
#include "sparse-index.h"
#include "log-tree.h"
#include "diffcore.h"
#include "reflog.h"
#include "add-interactive.h"

#define INCLUDE_ALL_FILES

#define BUILTIN_STASH_LIST_USAGE
#define BUILTIN_STASH_SHOW_USAGE
#define BUILTIN_STASH_DROP_USAGE
#define BUILTIN_STASH_POP_USAGE
#define BUILTIN_STASH_APPLY_USAGE
#define BUILTIN_STASH_BRANCH_USAGE
#define BUILTIN_STASH_STORE_USAGE
#define BUILTIN_STASH_PUSH_USAGE
#define BUILTIN_STASH_SAVE_USAGE
#define BUILTIN_STASH_CREATE_USAGE
#define BUILTIN_STASH_CLEAR_USAGE

static const char * const git_stash_usage[] =;

static const char * const git_stash_list_usage[] =;

static const char * const git_stash_show_usage[] =;

static const char * const git_stash_drop_usage[] =;

static const char * const git_stash_pop_usage[] =;

static const char * const git_stash_apply_usage[] =;

static const char * const git_stash_branch_usage[] =;

static const char * const git_stash_clear_usage[] =;

static const char * const git_stash_store_usage[] =;

static const char * const git_stash_push_usage[] =;

static const char * const git_stash_save_usage[] =;

static const char ref_stash[] =;
static struct strbuf stash_index_path =;

/*
 * w_commit is set to the commit containing the working tree
 * b_commit is set to the base commit
 * i_commit is set to the commit containing the index tree
 * u_commit is set to the commit containing the untracked files tree
 * w_tree is set to the working tree
 * b_tree is set to the base tree
 * i_tree is set to the index tree
 * u_tree is set to the untracked files tree
 */
struct stash_info {};

#define STASH_INFO_INIT

static void free_stash_info(struct stash_info *info)
{}

static void assert_stash_like(struct stash_info *info, const char *revision)
{}

static int get_stash_info(struct stash_info *info, int argc, const char **argv)
{}

static int do_clear_stash(void)
{}

static int clear_stash(int argc, const char **argv, const char *prefix)
{}

static int reset_tree(struct object_id *i_tree, int update, int reset)
{}

static int diff_tree_binary(struct strbuf *out, struct object_id *w_commit)
{}

static int apply_cached(struct strbuf *out)
{}

static int reset_head(void)
{}

static int is_path_a_directory(const char *path)
{}

static void add_diff_to_buf(struct diff_queue_struct *q,
			    struct diff_options *options UNUSED,
			    void *data)
{}

static int restore_untracked(struct object_id *u_tree)
{}

static void unstage_changes_unless_new(struct object_id *orig_tree)
{}

static int do_apply_stash(const char *prefix, struct stash_info *info,
			  int index, int quiet)
{}

static int apply_stash(int argc, const char **argv, const char *prefix)
{}

static int reject_reflog_ent(struct object_id *ooid UNUSED,
			     struct object_id *noid UNUSED,
			     const char *email UNUSED,
			     timestamp_t timestamp UNUSED,
			     int tz UNUSED, const char *message UNUSED,
			     void *cb_data UNUSED)
{}

static int reflog_is_empty(const char *refname)
{}

static int do_drop_stash(struct stash_info *info, int quiet)
{}

static int get_stash_info_assert(struct stash_info *info, int argc,
				 const char **argv)
{}

static int drop_stash(int argc, const char **argv, const char *prefix)
{}

static int pop_stash(int argc, const char **argv, const char *prefix)
{}

static int branch_stash(int argc, const char **argv, const char *prefix)
{}

static int list_stash(int argc, const char **argv, const char *prefix)
{}

static int show_stat =;
static int show_patch;
static int show_include_untracked;

static int git_stash_config(const char *var, const char *value,
			    const struct config_context *ctx, void *cb)
{}

static void diff_include_untracked(const struct stash_info *info, struct diff_options *diff_opt)
{}

static int show_stash(int argc, const char **argv, const char *prefix)
{}

static int do_store_stash(const struct object_id *w_commit, const char *stash_msg,
			  int quiet)
{}

static int store_stash(int argc, const char **argv, const char *prefix)
{}

static void add_pathspecs(struct strvec *args,
			  const struct pathspec *ps) {}

/*
 * `untracked_files` will be filled with the names of untracked files.
 * The return value is:
 *
 * = 0 if there are not any untracked files
 * > 0 if there are untracked files
 */
static int get_untracked_files(const struct pathspec *ps, int include_untracked,
			       struct strbuf *untracked_files)
{}

/*
 * The return value of `check_changes_tracked_files()` can be:
 *
 * < 0 if there was an error
 * = 0 if there are no changes.
 * > 0 if there are changes.
 */
static int check_changes_tracked_files(const struct pathspec *ps)
{}

/*
 * The function will fill `untracked_files` with the names of untracked files
 * It will return 1 if there were any changes and 0 if there were not.
 */
static int check_changes(const struct pathspec *ps, int include_untracked,
			 struct strbuf *untracked_files)
{}

static int save_untracked_files(struct stash_info *info, struct strbuf *msg,
				struct strbuf files)
{}

static int stash_staged(struct stash_info *info, struct strbuf *out_patch,
			int quiet)
{}

static int stash_patch(struct stash_info *info, const struct pathspec *ps,
		       struct strbuf *out_patch, int quiet)
{}

static int stash_working_tree(struct stash_info *info, const struct pathspec *ps)
{}

static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_buf,
			   int include_untracked, int patch_mode, int only_staged,
			   struct stash_info *info, struct strbuf *patch,
			   int quiet)
{}

static int create_stash(int argc, const char **argv, const char *prefix UNUSED)
{}

static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int quiet,
			 int keep_index, int patch_mode, int include_untracked, int only_staged)
{}

static int push_stash(int argc, const char **argv, const char *prefix,
		      int push_assumed)
{}

static int push_stash_unassumed(int argc, const char **argv, const char *prefix)
{}

static int save_stash(int argc, const char **argv, const char *prefix)
{}

int cmd_stash(int argc,
	      const char **argv,
	      const char *prefix,
	      struct repository *repo UNUSED)
{}