git/add-interactive.c

#define USE_THE_REPOSITORY_VARIABLE

#include "git-compat-util.h"
#include "add-interactive.h"
#include "color.h"
#include "config.h"
#include "diffcore.h"
#include "gettext.h"
#include "hash.h"
#include "hex.h"
#include "preload-index.h"
#include "read-cache-ll.h"
#include "repository.h"
#include "revision.h"
#include "refs.h"
#include "string-list.h"
#include "lockfile.h"
#include "dir.h"
#include "run-command.h"
#include "prompt.h"
#include "tree.h"

static void init_color(struct repository *r, struct add_i_state *s,
		       const char *section_and_slot, char *dst,
		       const char *default_color)
{}

void init_add_i_state(struct add_i_state *s, struct repository *r)
{}

void clear_add_i_state(struct add_i_state *s)
{}

/*
 * A "prefix item list" is a list of items that are identified by a string, and
 * a unique prefix (if any) is determined for each item.
 *
 * It is implemented in the form of a pair of `string_list`s, the first one
 * duplicating the strings, with the `util` field pointing at a structure whose
 * first field must be `size_t prefix_length`.
 *
 * That `prefix_length` field will be computed by `find_unique_prefixes()`; It
 * will be set to zero if no valid, unique prefix could be found.
 *
 * The second `string_list` is called `sorted` and does _not_ duplicate the
 * strings but simply reuses the first one's, with the `util` field pointing at
 * the `string_item_list` of the first `string_list`. It  will be populated and
 * sorted by `find_unique_prefixes()`.
 */
struct prefix_item_list {};
#define PREFIX_ITEM_LIST_INIT

static void prefix_item_list_clear(struct prefix_item_list *list)
{}

static void extend_prefix_length(struct string_list_item *p,
				 const char *other_string, size_t max_length)
{}

static void find_unique_prefixes(struct prefix_item_list *list)
{}

static ssize_t find_unique(const char *string, struct prefix_item_list *list)
{}

struct list_options {};

static void list(struct add_i_state *s, struct string_list *list, int *selected,
		 struct list_options *opts)
{}
struct list_and_choose_options {};

#define LIST_AND_CHOOSE_ERROR
#define LIST_AND_CHOOSE_QUIT

/*
 * Returns the selected index in singleton mode, the number of selected items
 * otherwise.
 *
 * If an error occurred, returns `LIST_AND_CHOOSE_ERROR`. Upon EOF,
 * `LIST_AND_CHOOSE_QUIT` is returned.
 */
static ssize_t list_and_choose(struct add_i_state *s,
			       struct prefix_item_list *items,
			       struct list_and_choose_options *opts)
{}

struct adddel {};

struct file_item {};

static void add_file_item(struct string_list *files, const char *name)
{}

struct pathname_entry {};

static int pathname_entry_cmp(const void *cmp_data UNUSED,
			      const struct hashmap_entry *he1,
			      const struct hashmap_entry *he2,
			      const void *name)
{}

struct collection_status {};

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

enum modified_files_filter {};

static int get_modified_files(struct repository *r,
			      enum modified_files_filter filter,
			      struct prefix_item_list *files,
			      const struct pathspec *ps,
			      size_t *unmerged_count,
			      size_t *binary_count)
{}

static void render_adddel(struct strbuf *buf,
				struct adddel *ad, const char *no_changes)
{}

/* filters out prefixes which have special meaning to list_and_choose() */
static int is_valid_prefix(const char *prefix, size_t prefix_len)
{}

struct print_file_item_data {};

static void print_file_item(int i, int selected, struct string_list_item *item,
			    void *print_file_item_data)
{}

static int run_status(struct add_i_state *s, const struct pathspec *ps,
		      struct prefix_item_list *files,
		      struct list_and_choose_options *opts)
{}

static int run_update(struct add_i_state *s, const struct pathspec *ps,
		      struct prefix_item_list *files,
		      struct list_and_choose_options *opts)
{}

static void revert_from_diff(struct diff_queue_struct *q,
			     struct diff_options *opt, void *data UNUSED)
{}

static int run_revert(struct add_i_state *s, const struct pathspec *ps,
		      struct prefix_item_list *files,
		      struct list_and_choose_options *opts)
{}

static int get_untracked_files(struct repository *r,
			       struct prefix_item_list *files,
			       const struct pathspec *ps)
{}

static int run_add_untracked(struct add_i_state *s, const struct pathspec *ps,
		      struct prefix_item_list *files,
		      struct list_and_choose_options *opts)
{}

static int run_patch(struct add_i_state *s, const struct pathspec *ps,
		     struct prefix_item_list *files,
		     struct list_and_choose_options *opts)
{}

static int run_diff(struct add_i_state *s, const struct pathspec *ps,
		    struct prefix_item_list *files,
		    struct list_and_choose_options *opts)
{}

static int run_help(struct add_i_state *s, const struct pathspec *ps UNUSED,
		    struct prefix_item_list *files UNUSED,
		    struct list_and_choose_options *opts UNUSED)
{}

static void choose_prompt_help(struct add_i_state *s)
{}

command_t;

struct command_item {};

struct print_command_item_data {};

static void print_command_item(int i, int selected UNUSED,
			       struct string_list_item *item,
			       void *print_command_item_data)
{}

static void command_prompt_help(struct add_i_state *s)
{}

int run_add_i(struct repository *r, const struct pathspec *ps)
{}