X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=advice.c;h=e02e632df380a8e9772d9cd9b1282204c56a7d4e;hb=a09a0c27094f15774e513286c02adacc11b6e6b2;hp=0be4b5f008e1646946ba12fa5e51aa0830911ece;hpb=c9de921848061db9316fe8dc2ebff4bcadf8117f;p=git.git diff --git a/advice.c b/advice.c index 0be4b5f00..e02e632df 100644 --- a/advice.c +++ b/advice.c @@ -19,6 +19,15 @@ static struct { { "detachedhead", &advice_detached_head }, }; +void advise(const char *advice, ...) +{ + va_list params; + + va_start(params, advice); + vreportf("hint: ", advice, params); + va_end(params); +} + int git_default_advice_config(const char *var, const char *value) { const char *k = skip_prefix(var, "advice."); @@ -34,16 +43,24 @@ int git_default_advice_config(const char *var, const char *value) return 0; } -void NORETURN die_resolve_conflict(const char *me) +int error_resolve_conflict(const char *me) { - if (advice_resolve_conflict) + error("'%s' is not possible because you have unmerged files.", me); + if (advice_resolve_conflict) { /* * Message used both when 'git commit' fails and when * other commands doing a merge do. */ - die("'%s' is not possible because you have unmerged files.\n" - "Please, fix them up in the work tree, and then use 'git add/rm ' as\n" - "appropriate to mark resolution and make a commit, or use 'git commit -a'.", me); - else - die("'%s' is not possible because you have unmerged files.", me); + advise("Fix them up in the work tree,"); + advise("and then use 'git add/rm ' as"); + advise("appropriate to mark resolution and make a commit,"); + advise("or use 'git commit -a'."); + } + return -1; +} + +void NORETURN die_resolve_conflict(const char *me) +{ + error_resolve_conflict(me); + die("Exiting because of an unresolved conflict."); }