#include "merge-ll.h"
#include "quote.h"
#include "strbuf.h"
+#include "gettext.h"
struct ll_merge_driver;
git_check_attr(istate, path, check);
ll_driver_name = check->items[0].value;
if (check->items[1].value) {
- marker_size = atoi(check->items[1].value);
+ if (strtol_i(check->items[1].value, 10, &marker_size)) {
+ marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
+ warning(_("invalid marker-size '%s', expecting an integer"), check->items[1].value);
+ }
if (marker_size <= 0)
marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
}
check = attr_check_initl("conflict-marker-size", NULL);
git_check_attr(istate, path, check);
if (check->items[0].value) {
- marker_size = atoi(check->items[0].value);
+ if (strtol_i(check->items[0].value, 10, &marker_size)) {
+ marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
+ warning(_("invalid marker-size '%s', expecting an integer"), check->items[0].value);
+ }
if (marker_size <= 0)
marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
}
grep "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" actual
'
+test_expect_success 'invalid conflict-marker-size 3a' '
+ cp .gitattributes .gitattributes.bak &&
+ echo "text conflict-marker-size=3a" >>.gitattributes &&
+ test_when_finished "mv .gitattributes.bak .gitattributes" &&
+ git checkout -m text 2>err &&
+ test_grep "warning: invalid marker-size ${SQ}3a${SQ}, expecting an integer" err
+'
+
test_expect_success 'custom merge backend' '
echo "* merge=union" >.gitattributes &&