| 322 | } |
| 323 | |
| 324 | static unsigned parse_color_moved_ws(const char *arg) |
| 325 | { |
| 326 | int ret = 0; |
| 327 | struct string_list l = STRING_LIST_INIT_DUP; |
| 328 | struct string_list_item *i; |
| 329 | |
| 330 | string_list_split_f(&l, arg, ",", -1, STRING_LIST_SPLIT_TRIM); |
| 331 | |
| 332 | for_each_string_list_item(i, &l) { |
| 333 | if (!strcmp(i->string, "no")) |
| 334 | ret = 0; |
| 335 | else if (!strcmp(i->string, "ignore-space-change")) |
| 336 | ret |= XDF_IGNORE_WHITESPACE_CHANGE; |
| 337 | else if (!strcmp(i->string, "ignore-space-at-eol")) |
| 338 | ret |= XDF_IGNORE_WHITESPACE_AT_EOL; |
| 339 | else if (!strcmp(i->string, "ignore-all-space")) |
| 340 | ret |= XDF_IGNORE_WHITESPACE; |
| 341 | else if (!strcmp(i->string, "allow-indentation-change")) |
| 342 | ret |= COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE; |
| 343 | else { |
| 344 | ret |= COLOR_MOVED_WS_ERROR; |
| 345 | error(_("unknown color-moved-ws mode '%s', possible values are 'ignore-space-change', 'ignore-space-at-eol', 'ignore-all-space', 'allow-indentation-change'"), i->string); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | if ((ret & COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE) && |
| 350 | (ret & XDF_WHITESPACE_FLAGS)) { |
| 351 | error(_("color-moved-ws: allow-indentation-change cannot be combined with other whitespace modes")); |
| 352 | ret |= COLOR_MOVED_WS_ERROR; |
| 353 | } |
| 354 | |
| 355 | string_list_clear(&l, 0); |
| 356 | |
| 357 | return ret; |
| 358 | } |
| 359 | |
| 360 | int git_diff_ui_config(const char *var, const char *value, |
| 361 | const struct config_context *ctx, void *cb) |
no test coverage detected