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