]>
Commit | Line | Data |
---|---|---|
75194438 JK |
1 | #include "cache.h" |
2 | ||
3 | int advice_push_nonfastforward = 1; | |
edf563fb | 4 | int advice_status_hints = 1; |
4c371f91 | 5 | int advice_commit_before_merge = 1; |
d38a30df | 6 | int advice_resolve_conflict = 1; |
b706fcfe | 7 | int advice_implicit_identity = 1; |
13be3e31 | 8 | int advice_detached_head = 1; |
75194438 JK |
9 | |
10 | static struct { | |
11 | const char *name; | |
12 | int *preference; | |
13 | } advice_config[] = { | |
14 | { "pushnonfastforward", &advice_push_nonfastforward }, | |
edf563fb | 15 | { "statushints", &advice_status_hints }, |
4c371f91 | 16 | { "commitbeforemerge", &advice_commit_before_merge }, |
d38a30df | 17 | { "resolveconflict", &advice_resolve_conflict }, |
b706fcfe | 18 | { "implicitidentity", &advice_implicit_identity }, |
13be3e31 | 19 | { "detachedhead", &advice_detached_head }, |
75194438 JK |
20 | }; |
21 | ||
22 | int git_default_advice_config(const char *var, const char *value) | |
23 | { | |
24 | const char *k = skip_prefix(var, "advice."); | |
25 | int i; | |
26 | ||
27 | for (i = 0; i < ARRAY_SIZE(advice_config); i++) { | |
28 | if (strcmp(k, advice_config[i].name)) | |
29 | continue; | |
30 | *advice_config[i].preference = git_config_bool(var, value); | |
31 | return 0; | |
32 | } | |
33 | ||
34 | return 0; | |
35 | } | |
d38a30df MM |
36 | |
37 | void NORETURN die_resolve_conflict(const char *me) | |
38 | { | |
39 | if (advice_resolve_conflict) | |
40 | /* | |
41 | * Message used both when 'git commit' fails and when | |
42 | * other commands doing a merge do. | |
43 | */ | |
44 | die("'%s' is not possible because you have unmerged files.\n" | |
45 | "Please, fix them up in the work tree, and then use 'git add/rm <file>' as\n" | |
46 | "appropriate to mark resolution and make a commit, or use 'git commit -a'.", me); | |
47 | else | |
48 | die("'%s' is not possible because you have unmerged files.", me); | |
49 | } |