| 101 | } |
| 102 | |
| 103 | static int notes_rewrite_config(const char *k, const char *v, |
| 104 | const struct config_context *ctx UNUSED, |
| 105 | void *cb) |
| 106 | { |
| 107 | struct notes_rewrite_cfg *c = cb; |
| 108 | if (starts_with(k, "notes.rewrite.") && !strcmp(k+14, c->cmd)) { |
| 109 | c->enabled = git_config_bool(k, v); |
| 110 | return 0; |
| 111 | } else if (!c->mode_from_env && !strcmp(k, "notes.rewritemode")) { |
| 112 | if (!v) |
| 113 | return config_error_nonbool(k); |
| 114 | c->combine = parse_combine_notes_fn(v); |
| 115 | if (!c->combine) { |
| 116 | error(_("Bad notes.rewriteMode value: '%s'"), v); |
| 117 | return 1; |
| 118 | } |
| 119 | return 0; |
| 120 | } else if (!c->refs_from_env && !strcmp(k, "notes.rewriteref")) { |
| 121 | if (!v) |
| 122 | return config_error_nonbool(k); |
| 123 | /* note that a refs/ prefix is implied in the |
| 124 | * underlying for_each_glob_ref */ |
| 125 | if (starts_with(v, "refs/notes/")) |
| 126 | string_list_add_refs_by_glob(c->refs, v); |
| 127 | else |
| 128 | warning(_("Refusing to rewrite notes in %s" |
| 129 | " (outside of refs/notes/)"), v); |
| 130 | return 0; |
| 131 | } |
| 132 | |
| 133 | return 0; |
| 134 | } |
| 135 | |
| 136 | |
| 137 | struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd) |
nothing calls this directly
no test coverage detected