]>
Commit | Line | Data |
---|---|---|
a00a42ae TH |
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 | */ | |
f8adbec9 | 10 | #define USE_THE_INDEX_COMPATIBILITY_MACROS |
a00a42ae TH |
11 | #include "git-compat-util.h" |
12 | #include "builtin.h" | |
a92b1095 | 13 | #include "diff.h" |
a00a42ae | 14 | |
20c7e3d5 JN |
15 | static const char builtin_merge_ours_usage[] = |
16 | "git merge-ours <base>... -- HEAD <remote>..."; | |
17 | ||
a00a42ae TH |
18 | int cmd_merge_ours(int argc, const char **argv, const char *prefix) |
19 | { | |
20c7e3d5 JN |
20 | if (argc == 2 && !strcmp(argv[1], "-h")) |
21 | usage(builtin_merge_ours_usage); | |
22 | ||
a00a42ae | 23 | /* |
a92b1095 JH |
24 | * The contents of the current index becomes the tree we |
25 | * commit. The index must match HEAD, or this merge cannot go | |
26 | * through. | |
a00a42ae | 27 | */ |
a92b1095 JH |
28 | if (read_cache() < 0) |
29 | die_errno("read_cache failed"); | |
ffc00a48 | 30 | if (index_differs_from(the_repository, "HEAD", NULL, 0)) |
a00a42ae TH |
31 | exit(2); |
32 | exit(0); | |
33 | } |