MCPcopy Create free account
hub / github.com/git/git / parse_color_moved_ws

Function parse_color_moved_ws

diff.c:324–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324static 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
360int git_diff_ui_config(const char *var, const char *value,
361 const struct config_context *ctx, void *cb)

Callers 2

git_diff_ui_configFunction · 0.85
diff_opt_color_moved_wsFunction · 0.85

Calls 3

string_list_split_fFunction · 0.85
errorFunction · 0.85
string_list_clearFunction · 0.85

Tested by

no test coverage detected