git/builtin/update-index.c

/*
 * GIT - The information manager from hell
 *
 * Copyright (C) Linus Torvalds, 2005
 */
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "bulk-checkin.h"
#include "config.h"
#include "environment.h"
#include "gettext.h"
#include "hash.h"
#include "hex.h"
#include "lockfile.h"
#include "quote.h"
#include "cache-tree.h"
#include "tree-walk.h"
#include "object-file.h"
#include "refs.h"
#include "resolve-undo.h"
#include "parse-options.h"
#include "pathspec.h"
#include "dir.h"
#include "read-cache.h"
#include "setup.h"
#include "sparse-index.h"
#include "split-index.h"
#include "symlinks.h"
#include "fsmonitor.h"
#include "write-or-die.h"

/*
 * Default to not allowing changes to the list of files. The
 * tool doesn't actually care, but this makes it harder to add
 * files to the revision control by mistake by doing something
 * like "git update-index *" and suddenly having all the object
 * files be revision controlled.
 */
static int allow_add;
static int allow_remove;
static int allow_replace;
static int info_only;
static int force_remove;
static int verbose;
static int mark_valid_only;
static int mark_skip_worktree_only;
static int mark_fsmonitor_only;
static int ignore_skip_worktree_entries;
#define MARK_FLAG
#define UNMARK_FLAG
static struct strbuf mtime_dir =;

/* Untracked cache mode */
enum uc_mode {};

__attribute__((format (printf, 1, 2)))
static void report(const char *fmt, ...)
{}

static void remove_test_directory(void)
{}

static const char *get_mtime_path(const char *path)
{}

static void xmkdir(const char *path)
{}

static int xstat_mtime_dir(struct stat *st)
{}

static int create_file(const char *path)
{}

static void xunlink(const char *path)
{}

static void xrmdir(const char *path)
{}

static void avoid_racy(void)
{}

static int test_if_untracked_cache_is_supported(void)
{}

static int mark_ce_flags(const char *path, int flag, int mark)
{}

static int remove_one_path(const char *path)
{}

/*
 * Handle a path that couldn't be lstat'ed. It's either:
 *  - missing file (ENOENT or ENOTDIR). That's ok if we're
 *    supposed to be removing it and the removal actually
 *    succeeds.
 *  - permission error. That's never ok.
 */
static int process_lstat_error(const char *path, int err)
{}

static int add_one_path(const struct cache_entry *old, const char *path, int len, struct stat *st)
{}

/*
 * Handle a path that was a directory. Four cases:
 *
 *  - it's already a gitlink in the index, and we keep it that
 *    way, and update it if we can (if we cannot find the HEAD,
 *    we're going to keep it unchanged in the index!)
 *
 *  - it's a *file* in the index, in which case it should be
 *    removed as a file if removal is allowed, since it doesn't
 *    exist as such any more. If removal isn't allowed, it's
 *    an error.
 *
 *    (NOTE! This is old and arguably fairly strange behaviour.
 *    We might want to make this an error unconditionally, and
 *    use "--force-remove" if you actually want to force removal).
 *
 *  - it used to exist as a subdirectory (ie multiple files with
 *    this particular prefix) in the index, in which case it's wrong
 *    to try to update it as a directory.
 *
 *  - it doesn't exist at all in the index, but it is a valid
 *    git directory, and it should be *added* as a gitlink.
 */
static int process_directory(const char *path, int len, struct stat *st)
{}

static int process_path(const char *path, struct stat *st, int stat_errno)
{}

static int add_cacheinfo(unsigned int mode, const struct object_id *oid,
			 const char *path, int stage)
{}

static void chmod_path(char flip, const char *path)
{}

static void update_one(const char *path)
{}

static void read_index_info(int nul_term_line)
{}

static const char * const update_index_usage[] =;

static struct cache_entry *read_one_ent(const char *which,
					struct object_id *ent, const char *path,
					int namelen, int stage)
{}

static int unresolve_one(const char *path)
{}

static int do_unresolve(int ac, const char **av,
			const char *prefix, int prefix_length)
{}

static int do_reupdate(const char **paths,
		       const char *prefix)
{}

struct refresh_params {};

static int refresh(struct refresh_params *o, unsigned int flag)
{}

static int refresh_callback(const struct option *opt,
				const char *arg, int unset)
{}

static int really_refresh_callback(const struct option *opt,
				const char *arg, int unset)
{}

static int chmod_callback(const struct option *opt,
				const char *arg, int unset)
{}

static int resolve_undo_clear_callback(const struct option *opt UNUSED,
				const char *arg, int unset)
{}

static int parse_new_style_cacheinfo(const char *arg,
				     unsigned int *mode,
				     struct object_id *oid,
				     const char **path)
{}

static enum parse_opt_result cacheinfo_callback(
	struct parse_opt_ctx_t *ctx, const struct option *opt UNUSED,
	const char *arg, int unset)
{}

static enum parse_opt_result stdin_cacheinfo_callback(
	struct parse_opt_ctx_t *ctx, const struct option *opt,
	const char *arg, int unset)
{}

static enum parse_opt_result stdin_callback(
	struct parse_opt_ctx_t *ctx, const struct option *opt,
	const char *arg, int unset)
{}

static enum parse_opt_result unresolve_callback(
	struct parse_opt_ctx_t *ctx, const struct option *opt,
	const char *arg, int unset)
{}

static enum parse_opt_result reupdate_callback(
	struct parse_opt_ctx_t *ctx, const struct option *opt,
	const char *arg, int unset)
{}

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