THIS PATCH SERIES IS NOT CODE-COMPLETE OR FULLY TESTED. See code comments beginning TODO for work remaining. This will allow the message to be re-used in other places. Signed-off-by: Stephen Robin <stephen.robin@xxxxxxxxx> --- advice.c | 9 +++++++++ advice.h | 1 + builtin/merge.c | 6 +----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/advice.c b/advice.c index 575bec2..747792e 100644 --- a/advice.c +++ b/advice.c @@ -96,6 +96,15 @@ void NORETURN die_resolve_conflict(const char *me) die("Exiting because of an unresolved conflict."); } +void NORETURN die_merge_in_progress() +{ + if (advice_resolve_conflict) + die(_("You have not concluded your merge (MERGE_HEAD exists).\n" + "Please, commit your changes before you merge.")); + else + die(_("You have not concluded your merge (MERGE_HEAD exists).")); +} + void detach_advice(const char *new_name) { const char fmt[] = diff --git a/advice.h b/advice.h index 5ecc6c1..75c261a 100644 --- a/advice.h +++ b/advice.h @@ -24,6 +24,7 @@ __attribute__((format (printf, 1, 2))) void advise(const char *advice, ...); int error_resolve_conflict(const char *me); extern void NORETURN die_resolve_conflict(const char *me); +extern void NORETURN die_merge_in_progress(); void detach_advice(const char *new_name); #endif /* ADVICE_H */ diff --git a/builtin/merge.c b/builtin/merge.c index d6b0579..45d93bb 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1134,11 +1134,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) * There is no unmerged entry, don't advise 'git * add/rm <file>', just 'git commit'. */ - if (advice_resolve_conflict) - die(_("You have not concluded your merge (MERGE_HEAD exists).\n" - "Please, commit your changes before you merge.")); - else - die(_("You have not concluded your merge (MERGE_HEAD exists).")); + die_merge_in_progress(); } if (file_exists(git_path("CHERRY_PICK_HEAD"))) { if (advice_resolve_conflict) -- 2.4.0.7.gf20f26f -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html