builtin-merge-ours.con commit Re-implement 'git remote update' using 'git fetch' (8db3559)
   1/*
   2 * Implementation of git-merge-ours.sh as builtin
   3 *
   4 * Copyright (c) 2007 Thomas Harning Jr
   5 * Original:
   6 * Original Copyright (c) 2005 Junio C Hamano
   7 *
   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
  13static const char *diff_index_args[] = {
  14        "diff-index", "--quiet", "--cached", "HEAD", "--", NULL
  15};
  16#define NARGS (ARRAY_SIZE(diff_index_args) - 1)
  17
  18int cmd_merge_ours(int argc, const char **argv, const char *prefix)
  19{
  20        /*
  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.
  24         */
  25        if (cmd_diff_index(NARGS, diff_index_args, prefix))
  26                exit(2);
  27        exit(0);
  28}