git/builtin/merge.c

/*
 * Builtin "git merge"
 *
 * Copyright (c) 2008 Miklos Vajna <[email protected]>
 *
 * Based on git-merge.sh by Junio C Hamano.
 */
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"

#include "abspath.h"
#include "advice.h"
#include "config.h"
#include "editor.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "object-name.h"
#include "parse-options.h"
#include "lockfile.h"
#include "repository.h"
#include "run-command.h"
#include "hook.h"
#include "diff.h"
#include "diff-merges.h"
#include "refs.h"
#include "refspec.h"
#include "commit.h"
#include "diffcore.h"
#include "path.h"
#include "revision.h"
#include "unpack-trees.h"
#include "cache-tree.h"
#include "dir.h"
#include "color.h"
#include "rerere.h"
#include "help.h"
#include "merge.h"
#include "merge-recursive.h"
#include "merge-ort-wrappers.h"
#include "resolve-undo.h"
#include "remote.h"
#include "fmt-merge-msg.h"
#include "sequencer.h"
#include "string-list.h"
#include "tag.h"
#include "alias.h"
#include "branch.h"
#include "commit-reach.h"
#include "wt-status.h"
#include "commit-graph.h"

#define DEFAULT_TWOHEAD
#define DEFAULT_OCTOPUS
#define NO_FAST_FORWARD
#define NO_TRIVIAL

struct strategy {};

static const char * const builtin_merge_usage[] =;

static int show_diffstat =, shortlog_len =, squash;
static int option_commit =;
static int option_edit =;
static int allow_trivial =, have_message, verify_signatures;
static int check_trust_level =;
static int overwrite_ignore =;
static struct strbuf merge_msg =;
static struct strategy **use_strategies;
static size_t use_strategies_nr, use_strategies_alloc;
static struct strvec xopts =;
static const char *branch;
static char *branch_mergeoptions;
static int verbosity;
static int allow_rerere_auto;
static int abort_current_merge;
static int quit_current_merge;
static int continue_current_merge;
static int allow_unrelated_histories;
static int show_progress =;
static int default_to_upstream =;
static int signoff;
static const char *sign_commit;
static int autostash;
static int no_verify;
static char *into_name;

static struct strategy all_strategy[] =;

static char *pull_twohead, *pull_octopus;

enum ff_type {};

static enum ff_type fast_forward =;

static char *cleanup_arg;
static enum commit_msg_cleanup_mode cleanup_mode;

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

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

static struct strategy *get_strategy(const char *name)
{}

static void append_strategy(struct strategy *s)
{}

static int option_parse_strategy(const struct option *opt UNUSED,
				 const char *name, int unset)
{}

static struct option builtin_merge_options[] =;

static int save_state(struct object_id *stash)
{}

static void read_empty(const struct object_id *oid)
{}

static void reset_hard(const struct object_id *oid)
{}

static void restore_state(const struct object_id *head,
			  const struct object_id *stash)
{}

/* This is called when no merge was necessary. */
static void finish_up_to_date(void)
{}

static void squash_message(struct commit *commit, struct commit_list *remoteheads)
{}

static void finish(struct commit *head_commit,
		   struct commit_list *remoteheads,
		   const struct object_id *new_head, const char *msg)
{}

/* Get the name for the merge commit's message. */
static void merge_name(const char *remote, struct strbuf *msg)
{}

static void parse_branch_merge_options(char *bmo)
{}

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

static int read_tree_trivial(struct object_id *common, struct object_id *head,
			     struct object_id *one)
{}

static void write_tree_trivial(struct object_id *oid)
{}

static int try_merge_strategy(const char *strategy, struct commit_list *common,
			      struct commit_list *remoteheads,
			      struct commit *head)
{}

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

static int count_unmerged_entries(void)
{}

static void add_strategies(const char *string, unsigned attr)
{}

static void read_merge_msg(struct strbuf *msg)
{}

static void write_merge_state(struct commit_list *);
static void abort_commit(struct commit_list *remoteheads, const char *err_msg)
{}

static const char merge_editor_comment[] =);

static const char scissors_editor_comment[] =);

static const char no_scissors_editor_comment[] =);

static void write_merge_heads(struct commit_list *);
static void prepare_to_commit(struct commit_list *remoteheads)
{}

static int merge_trivial(struct commit *head, struct commit_list *remoteheads)
{}

static int finish_automerge(struct commit *head,
			    int head_subsumed,
			    struct commit_list *common,
			    struct commit_list *remoteheads,
			    struct object_id *result_tree,
			    const char *wt_strategy)
{}

static int suggest_conflicts(void)
{}

static int evaluate_result(void)
{}

/*
 * Pretend as if the user told us to merge with the remote-tracking
 * branch we have for the upstream of the current branch
 */
static int setup_with_upstream(const char ***argv)
{}

static void write_merge_heads(struct commit_list *remoteheads)
{}

static void write_merge_state(struct commit_list *remoteheads)
{}

static int default_edit_option(void)
{}

static struct commit_list *reduce_parents(struct commit *head_commit,
					  int *head_subsumed,
					  struct commit_list *remoteheads)
{}

static void prepare_merge_message(struct strbuf *merge_names, struct strbuf *merge_msg)
{}

static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge_names)
{}

static struct commit_list *collect_parents(struct commit *head_commit,
					   int *head_subsumed,
					   int argc, const char **argv,
					   struct strbuf *merge_msg)
{}

static int merging_a_throwaway_tag(struct commit *commit)
{}

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