| 271 | } |
| 272 | |
| 273 | static int git_sequencer_config(const char *k, const char *v, |
| 274 | const struct config_context *ctx, void *cb) |
| 275 | { |
| 276 | struct replay_opts *opts = cb; |
| 277 | |
| 278 | if (!strcmp(k, "commit.cleanup")) { |
| 279 | if (!v) |
| 280 | return config_error_nonbool(k); |
| 281 | |
| 282 | if (!strcmp(v, "verbatim")) { |
| 283 | opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE; |
| 284 | opts->explicit_cleanup = 1; |
| 285 | } else if (!strcmp(v, "whitespace")) { |
| 286 | opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE; |
| 287 | opts->explicit_cleanup = 1; |
| 288 | } else if (!strcmp(v, "strip")) { |
| 289 | opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_ALL; |
| 290 | opts->explicit_cleanup = 1; |
| 291 | } else if (!strcmp(v, "scissors")) { |
| 292 | opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SCISSORS; |
| 293 | opts->explicit_cleanup = 1; |
| 294 | } else { |
| 295 | warning(_("invalid commit message cleanup mode '%s'"), |
| 296 | v); |
| 297 | } |
| 298 | |
| 299 | return 0; |
| 300 | } |
| 301 | |
| 302 | if (!strcmp(k, "commit.gpgsign")) { |
| 303 | free(opts->gpg_sign); |
| 304 | opts->gpg_sign = git_config_bool(k, v) ? xstrdup("") : NULL; |
| 305 | return 0; |
| 306 | } |
| 307 | |
| 308 | if (!opts->default_strategy && !strcmp(k, "pull.twohead")) { |
| 309 | int ret = git_config_string(&opts->default_strategy, k, v); |
| 310 | if (ret == 0) { |
| 311 | /* |
| 312 | * pull.twohead is allowed to be multi-valued; we only |
| 313 | * care about the first value. |
| 314 | */ |
| 315 | char *tmp = strchr(opts->default_strategy, ' '); |
| 316 | if (tmp) |
| 317 | *tmp = '\0'; |
| 318 | } |
| 319 | return ret; |
| 320 | } |
| 321 | |
| 322 | if (opts->action == REPLAY_REVERT && !strcmp(k, "revert.reference")) |
| 323 | opts->commit_use_reference = git_config_bool(k, v); |
| 324 | |
| 325 | return git_diff_basic_config(k, v, ctx, NULL); |
| 326 | } |
| 327 | |
| 328 | void sequencer_init_config(struct replay_opts *opts) |
| 329 | { |
nothing calls this directly
no test coverage detected