Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/builtin/merge-ours.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / builtin / merge-ours.c` 41 lines ยท 1039 bytes Raw Blame History 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 11 #include "git-compat-util.h" 12 #include "builtin.h" 13 #include "config.h" 14 #include "environment.h" 15 #include "diff.h" 16 17 static const char builtin_merge_ours_usage[] = 18 "git merge-ours ... -- HEAD ..."; 19 20 int cmd_merge_ours(int argc, 21 const char **argv, 22 const char *prefix UNUSED, 23 struct repository *repo) 24 { 25 show_usage_if_asked(argc, argv, builtin_merge_ours_usage); 26 27 repo_config(repo, git_default_config, NULL); 28 prepare_repo_settings(repo); 29 repo->settings.command_requires_full_index = 0; 30 31 /* 32 * The contents of the current index becomes the tree we 33 * commit. The index must match HEAD, or this merge cannot go 34 * through. 35 */ 36 if (repo_read_index(repo) < 0) 37 die_errno("read_cache failed"); 38 if (index_differs_from(repo, "HEAD", NULL, 0)) 39 return 2; 40 return 0; 41 }