3 int advice_push_nonfastforward
= 1;
4 int advice_status_hints
= 1;
5 int advice_commit_before_merge
= 1;
6 int advice_resolve_conflict
= 1;
7 int advice_implicit_identity
= 1;
8 int advice_detached_head
= 1;
14 { "pushnonfastforward", &advice_push_nonfastforward
},
15 { "statushints", &advice_status_hints
},
16 { "commitbeforemerge", &advice_commit_before_merge
},
17 { "resolveconflict", &advice_resolve_conflict
},
18 { "implicitidentity", &advice_implicit_identity
},
19 { "detachedhead", &advice_detached_head
},
22 void advise(const char *advice
, ...)
24 struct strbuf buf
= STRBUF_INIT
;
28 va_start(params
, advice
);
29 strbuf_addf(&buf
, advice
, params
);
32 for (cp
= buf
.buf
; *cp
; cp
= np
) {
33 np
= strchrnul(cp
, '\n');
34 fprintf(stderr
, _("hint: %.*s\n"), (int)(np
- cp
), cp
);
41 int git_default_advice_config(const char *var
, const char *value
)
43 const char *k
= skip_prefix(var
, "advice.");
46 for (i
= 0; i
< ARRAY_SIZE(advice_config
); i
++) {
47 if (strcmp(k
, advice_config
[i
].name
))
49 *advice_config
[i
].preference
= git_config_bool(var
, value
);
56 int error_resolve_conflict(const char *me
)
58 error("'%s' is not possible because you have unmerged files.", me
);
59 if (advice_resolve_conflict
)
61 * Message used both when 'git commit' fails and when
62 * other commands doing a merge do.
64 advise(_("Fix them up in the work tree,\n"
65 "and then use 'git add/rm <file>' as\n"
66 "appropriate to mark resolution and make a commit,\n"
67 "or use 'git commit -a'."));
71 void NORETURN
die_resolve_conflict(const char *me
)
73 error_resolve_conflict(me
);
74 die("Exiting because of an unresolved conflict.");