Skip to content

Commit 22e2741

Browse files
peffgitster
authored andcommitted
git_xmerge_config(): prefer error() to die()
When parsing merge config, a few code paths die on error. It's preferable for us to call error() here, because the resulting error message from the config parsing code contains much more detail. For example, before: fatal: unknown style 'bogus' given for 'merge.conflictstyle' and after: error: unknown style 'bogus' given for 'merge.conflictstyle' fatal: bad config variable 'merge.conflictstyle' in file '.git/config' at line 7 Since we're touching these lines, I also marked them for translation. There's no reason they shouldn't behave like most other config-parsing errors. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 41f98fa commit 22e2741

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

xdiff-interface.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "git-compat-util.h"
2+
#include "gettext.h"
23
#include "config.h"
34
#include "hex.h"
45
#include "object-store-ll.h"
@@ -313,7 +314,7 @@ int git_xmerge_config(const char *var, const char *value,
313314
{
314315
if (!strcmp(var, "merge.conflictstyle")) {
315316
if (!value)
316-
die("'%s' is not a boolean", var);
317+
return error(_("'%s' is not a boolean"), var);
317318
if (!strcmp(value, "diff3"))
318319
git_xmerge_style = XDL_MERGE_DIFF3;
319320
else if (!strcmp(value, "zdiff3"))
@@ -325,8 +326,8 @@ int git_xmerge_config(const char *var, const char *value,
325326
* git-completion.bash when you add new merge config
326327
*/
327328
else
328-
die("unknown style '%s' given for '%s'",
329-
value, var);
329+
return error(_("unknown style '%s' given for '%s'"),
330+
value, var);
330331
return 0;
331332
}
332333
return git_default_config(var, value, ctx, cb);

0 commit comments

Comments
 (0)