git/builtin/commit.c

/*
 * Builtin "git commit"
 *
 * Copyright (c) 2007 Kristian Høgsberg <[email protected]>
 * Based on git-commit.sh by Junio C Hamano and Linus Torvalds
 */
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "config.h"
#include "lockfile.h"
#include "cache-tree.h"
#include "color.h"
#include "dir.h"
#include "editor.h"
#include "environment.h"
#include "diff.h"
#include "commit.h"
#include "gettext.h"
#include "revision.h"
#include "wt-status.h"
#include "run-command.h"
#include "strbuf.h"
#include "object-name.h"
#include "parse-options.h"
#include "path.h"
#include "preload-index.h"
#include "read-cache.h"
#include "repository.h"
#include "string-list.h"
#include "rerere.h"
#include "unpack-trees.h"
#include "column.h"
#include "sequencer.h"
#include "sparse-index.h"
#include "mailmap.h"
#include "help.h"
#include "commit-reach.h"
#include "commit-graph.h"
#include "pretty.h"
#include "trailer.h"

static const char * const builtin_commit_usage[] =;

static const char * const builtin_status_usage[] =;

static const char empty_amend_advice[] =);

static const char empty_cherry_pick_advice[] =);

static const char empty_rebase_pick_advice[] =);

static const char empty_cherry_pick_advice_single[] =);

static const char empty_cherry_pick_advice_multi[] =);

static const char *color_status_slots[] =;

static const char *use_message_buffer;
static struct lock_file index_lock; /* real index */
static struct lock_file false_lock; /* used only for partial commits */
static enum {} commit_style;

static const char *force_author;
static char *logfile;
static char *template_file;
/*
 * The _message variables are commit names from which to take
 * the commit message and/or authorship.
 */
static const char *author_message, *author_message_buffer;
static const char *edit_message, *use_message;
static char *fixup_message, *fixup_commit, *squash_message;
static const char *fixup_prefix;
static int all, also, interactive, patch_interactive, only, amend, signoff;
static int edit_flag =; /* unspecified */
static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;
static int config_commit_verbose =; /* unspecified */
static int no_post_rewrite, allow_empty_message, pathspec_file_nul;
static const char *untracked_files_arg, *force_date, *ignore_submodule_arg, *ignored_arg;
static const char *sign_commit, *pathspec_from_file;
static struct strvec trailer_args =;

/*
 * The default commit message cleanup mode will remove the lines
 * beginning with # (shell comments) and leading and trailing
 * whitespaces (empty lines or containing only whitespaces)
 * if editor is used, and only the whitespaces if the message
 * is specified explicitly.
 */
static enum commit_msg_cleanup_mode cleanup_mode;
static char *cleanup_arg;

static enum commit_whence whence;
static int use_editor =, include_status =;
static int have_option_m;
static struct strbuf message =;

static enum wt_status_format status_format =;

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

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

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

static void determine_whence(struct wt_status *s)
{}

static void status_init_config(struct wt_status *s, config_fn_t fn)
{}

static void rollback_index_files(void)
{}

static int commit_index_files(void)
{}

/*
 * Take a union of paths in the index and the named tree (typically, "HEAD"),
 * and return the paths that match the given pattern in list.
 */
static int list_paths(struct string_list *list, const char *with_tree,
		      const struct pathspec *pattern)
{}

static void add_remove_files(struct string_list *list)
{}

static void create_base_index(const struct commit *current_head)
{}

static void refresh_cache_or_die(int refresh_flags)
{}

static const char *prepare_index(const char **argv, const char *prefix,
				 const struct commit *current_head, int is_status)
{}

static int run_status(FILE *fp, const char *index_file, const char *prefix, int nowarn,
		      struct wt_status *s)
{}

static int is_a_merge(const struct commit *current_head)
{}

static void assert_split_ident(struct ident_split *id, const struct strbuf *buf)
{}

static void export_one(const char *var, const char *s, const char *e, int hack)
{}

static int parse_force_date(const char *in, struct strbuf *out)
{}

static void set_ident_var(char **buf, char *val)
{}

static void determine_author_info(struct strbuf *author_ident)
{}

static int author_date_is_interesting(void)
{}

static void adjust_comment_line_char(const struct strbuf *sb)
{}

static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,
				struct pretty_print_context *ctx)
{}

static int prepare_to_commit(const char *index_file, const char *prefix,
			     struct commit *current_head,
			     struct wt_status *s,
			     struct strbuf *author_ident)
{}

static const char *find_author_by_nickname(const char *name)
{}

static void handle_ignored_arg(struct wt_status *s)
{}

static enum untracked_status_type parse_untracked_setting_name(const char *u)
{}

static void handle_untracked_files_arg(struct wt_status *s)
{}

static const char *read_commit_message(const char *name)
{}

/*
 * Enumerate what needs to be propagated when --porcelain
 * is not in effect here.
 */
static struct status_deferred_config {} status_deferred_config =;

static void finalize_deferred_config(struct wt_status *s)
{}

static void check_fixup_reword_options(int argc, const char *argv[]) {}

static int parse_and_validate_options(int argc, const char *argv[],
				      const struct option *options,
				      const char * const usage[],
				      const char *prefix,
				      struct commit *current_head,
				      struct wt_status *s)
{}

static int dry_run_commit(const char **argv, const char *prefix,
			  const struct commit *current_head, struct wt_status *s)
{}

define_list_config_array_extra();

static int parse_status_slot(const char *slot)
{}

static int git_status_config(const char *k, const char *v,
			     const struct config_context *ctx, void *cb)
{}

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

static int git_commit_config(const char *k, const char *v,
			     const struct config_context *ctx, void *cb)
{}

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