From: Ramkumar Ramachandra Date: Tue, 21 Jun 2011 13:04:37 GMT Subject: [PATCH 01/13] advice: Introduce error_resolve_conflict Message-ID: <1308661489-20080-2-git-send-email-artagnon@gmail.com> In-Reply-To: <1308661489-20080-1-git-send-email-artagnon@gmail.com> Introduce error_resolve_conflict corresponding to die_resolve_conflict, and implement the latter function in terms of the former. The only trade-off is that die_resolve_conflict is a little noisier now. Inspired-by: Christian Couder Helped-by: Jonathan Nieder Signed-off-by: Ramkumar Ramachandra --- advice.c | 19 +++++++++++++------ advice.h | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/advice.c b/advice.c index 0be4b5f..652680a 100644 --- a/advice.c +++ b/advice.c @@ -34,16 +34,23 @@ 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) { + 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); + return error("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'."); + return -1; +} + +void NORETURN die_resolve_conflict(const char *me) +{ + error_resolve_conflict(me); + die("Exiting because of an unresolved conflict."); } diff --git a/advice.h b/advice.h index 3244ebb..f537366 100644 --- a/advice.h +++ b/advice.h @@ -12,6 +12,7 @@ extern int advice_detached_head; int git_default_advice_config(const char *var, const char *value); +int error_resolve_conflict(const char *me); extern void NORETURN die_resolve_conflict(const char *me); #endif /* ADVICE_H */ -- 1.7.5.GIT