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

Function populate_opts_cb

sequencer.c:3078–3131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3076}
3077
3078static int populate_opts_cb(const char *key, const char *value,
3079 const struct config_context *ctx,
3080 void *data)
3081{
3082 struct replay_opts *opts = data;
3083 int error_flag = 1;
3084
3085 if (!value)
3086 error_flag = 0;
3087 else if (!strcmp(key, "options.no-commit"))
3088 opts->no_commit = git_config_bool_or_int(key, value, ctx->kvi, &error_flag);
3089 else if (!strcmp(key, "options.edit"))
3090 opts->edit = git_config_bool_or_int(key, value, ctx->kvi, &error_flag);
3091 else if (!strcmp(key, "options.allow-empty"))
3092 opts->allow_empty =
3093 git_config_bool_or_int(key, value, ctx->kvi, &error_flag);
3094 else if (!strcmp(key, "options.allow-empty-message"))
3095 opts->allow_empty_message =
3096 git_config_bool_or_int(key, value, ctx->kvi, &error_flag);
3097 else if (!strcmp(key, "options.drop-redundant-commits"))
3098 opts->drop_redundant_commits =
3099 git_config_bool_or_int(key, value, ctx->kvi, &error_flag);
3100 else if (!strcmp(key, "options.keep-redundant-commits"))
3101 opts->keep_redundant_commits =
3102 git_config_bool_or_int(key, value, ctx->kvi, &error_flag);
3103 else if (!strcmp(key, "options.signoff"))
3104 opts->signoff = git_config_bool_or_int(key, value, ctx->kvi, &error_flag);
3105 else if (!strcmp(key, "options.record-origin"))
3106 opts->record_origin = git_config_bool_or_int(key, value, ctx->kvi, &error_flag);
3107 else if (!strcmp(key, "options.allow-ff"))
3108 opts->allow_ff = git_config_bool_or_int(key, value, ctx->kvi, &error_flag);
3109 else if (!strcmp(key, "options.mainline"))
3110 opts->mainline = git_config_int(key, value, ctx->kvi);
3111 else if (!strcmp(key, "options.strategy"))
3112 git_config_string_dup(&opts->strategy, key, value);
3113 else if (!strcmp(key, "options.gpg-sign"))
3114 git_config_string_dup(&opts->gpg_sign, key, value);
3115 else if (!strcmp(key, "options.strategy-option")) {
3116 strvec_push(&opts->xopts, value);
3117 } else if (!strcmp(key, "options.allow-rerere-auto"))
3118 opts->allow_rerere_auto =
3119 git_config_bool_or_int(key, value, ctx->kvi, &error_flag) ?
3120 RERERE_AUTOUPDATE : RERERE_NOAUTOUPDATE;
3121 else if (!strcmp(key, "options.default-msg-cleanup")) {
3122 opts->explicit_cleanup = 1;
3123 opts->default_msg_cleanup = get_cleanup_mode(value, 1);
3124 } else
3125 return error(_("invalid key: %s"), key);
3126
3127 if (!error_flag)
3128 return error(_("invalid value for '%s': '%s'"), key, value);
3129
3130 return 0;
3131}
3132
3133static void parse_strategy_opts(struct replay_opts *opts, char *raw_opts)
3134{

Callers

nothing calls this directly

Calls 6

git_config_bool_or_intFunction · 0.85
git_config_intFunction · 0.85
git_config_string_dupFunction · 0.85
strvec_pushFunction · 0.85
get_cleanup_modeFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected