2 * Implementation of git-merge-ours.sh as builtin
4 * Copyright (c) 2007 Thomas Harning Jr
6 * Original Copyright (c) 2005 Junio C Hamano
8 * Pretend we resolved the heads, but declare our tree trumps everybody else.
10 #include "git-compat-util.h"
13 static const char builtin_merge_ours_usage
[] =
14 "git merge-ours <base>... -- HEAD <remote>...";
16 static const char *diff_index_args
[] = {
17 "diff-index", "--quiet", "--cached", "HEAD", "--", NULL
19 #define NARGS (ARRAY_SIZE(diff_index_args) - 1)
21 int cmd_merge_ours(int argc
, const char **argv
, const char *prefix
)
23 if (argc
== 2 && !strcmp(argv
[1], "-h"))
24 usage(builtin_merge_ours_usage
);
27 * We need to exit with 2 if the index does not match our HEAD tree,
28 * because the current index is what we will be committing as the
31 if (cmd_diff_index(NARGS
, diff_index_args
, prefix
))