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 #define USE_THE_REPOSITORY_VARIABLE
11 #include "git-compat-util.h"
16 static const char builtin_merge_ours_usage
[] =
17 "git merge-ours <base>... -- HEAD <remote>...";
19 int cmd_merge_ours(int argc
,
21 const char *prefix UNUSED
,
22 struct repository
*repo UNUSED
)
24 if (argc
== 2 && !strcmp(argv
[1], "-h"))
25 usage(builtin_merge_ours_usage
);
28 * The contents of the current index becomes the tree we
29 * commit. The index must match HEAD, or this merge cannot go
32 if (repo_read_index(the_repository
) < 0)
33 die_errno("read_cache failed");
34 if (index_differs_from(the_repository
, "HEAD", NULL
, 0))