am: simplify "sq" function by using "git rev-parse --sq-quote"
[alt-git.git] / builtin-merge-ours.c
blob8f5bbaf402e020e308e7af9cedb7df1b2ec5a2b7
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"
13 static const char *diff_index_args[] = {
14 "diff-index", "--quiet", "--cached", "HEAD", "--", NULL
16 #define NARGS (ARRAY_SIZE(diff_index_args) - 1)
18 int cmd_merge_ours(int argc, const char **argv, const char *prefix)
21 * We need to exit with 2 if the index does not match our HEAD tree,
22 * because the current index is what we will be committing as the
23 * merge result.
25 if (cmd_diff_index(NARGS, diff_index_args, prefix))
26 exit(2);
27 exit(0);