completion: move __git_complete_index_file() next to its helpers
[git/debian.git] / builtin / merge-ours.c
blobc84c6e05e922f09692b9b133cd391b850c7951df
1 /*
2 * Implementation of git-merge-ours.sh as builtin
4 * Copyright (c) 2007 Thomas Harning Jr
5 * Original:
6 * Original Copyright (c) 2005 Junio C Hamano
8 * Pretend we resolved the heads, but declare our tree trumps everybody else.
9 */
10 #include "git-compat-util.h"
11 #include "builtin.h"
12 #include "diff.h"
14 static const char builtin_merge_ours_usage[] =
15 "git merge-ours <base>... -- HEAD <remote>...";
17 int cmd_merge_ours(int argc, const char **argv, const char *prefix)
19 if (argc == 2 && !strcmp(argv[1], "-h"))
20 usage(builtin_merge_ours_usage);
23 * The contents of the current index becomes the tree we
24 * commit. The index must match HEAD, or this merge cannot go
25 * through.
27 if (read_cache() < 0)
28 die_errno("read_cache failed");
29 if (index_differs_from("HEAD", NULL, 0))
30 exit(2);
31 exit(0);