132
static GIT_PATH_FUNC(rebase_path_strategy_opts, "rebase-merge/strategy_opts")
133
static GIT_PATH_FUNC(rebase_path_allow_rerere_autoupdate, "rebase-merge/allow_rerere_autoupdate")
134
135
+static int git_sequencer_config(const char *k, const char *v, void *cb)
136
+{
137
+ struct replay_opts *opts = cb;
138
+ int status;
139
+
140
+ if (!strcmp(k, "commit.cleanup")) {
141
+ const char *s;
142
+
143
+ status = git_config_string(&s, k, v);
144
+ if (status)
145
+ return status;
146
+
147
+ if (!strcmp(s, "verbatim"))
148
+ opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;
149
+ else if (!strcmp(s, "whitespace"))
150
+ opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE;
151
+ else if (!strcmp(s, "strip"))
152
+ opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_ALL;
153
+ else if (!strcmp(s, "scissors"))
154
+ opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE;
155
+ else
156
+ warning(_("invalid commit message cleanup mode '%s'"),
157
+ s);
158
+
159
+ return status;
160
+ }
161
+
162
+ if (!strcmp(k, "commit.gpgsign")) {
163
+ opts->gpg_sign = git_config_bool(k, v) ? "" : NULL;
164
+ return 0;
165
+ }
166
+
167
+ status = git_gpg_config(k, v, NULL);
168
+ if (status)
169
+ return status;
170
+
171
+ return git_diff_basic_config(k, v, NULL);
172
+}
173
+
174
+void sequencer_init_config(struct replay_opts *opts)
175
+{
176
+ opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;
177
+ git_config(git_sequencer_config, opts);
178
+}
179
+
180
static inline int is_rebase_i(const struct replay_opts *opts)
181
{
182
return opts->action == REPLAY_INTERACTIVE_REBASE;
745
return run_command(&cmd);
746
}
747
703
-static enum commit_msg_cleanup_mode default_msg_cleanup =
704
- COMMIT_MSG_CLEANUP_NONE;
705
-static char *default_gpg_sign;
706
-
707
-int git_sequencer_config(const char *k, const char *v, void *cb)
708
-{
709
- if (!strcmp(k, "commit.cleanup")) {
710
- int status;
711
- const char *s;
712
-
713
- status = git_config_string(&s, k, v);
714
- if (status)
715
- return status;
716
-
717
- if (!strcmp(s, "verbatim"))
718
- default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;
719
- else if (!strcmp(s, "whitespace"))
720
- default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE;
721
- else if (!strcmp(s, "strip"))
722
- default_msg_cleanup = COMMIT_MSG_CLEANUP_ALL;
723
- else if (!strcmp(s, "scissors"))
724
- default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE;
725
-
726
- return status;
727
- }
728
-
729
- if (!strcmp(k, "commit.gpgsign")) {
730
- default_gpg_sign = git_config_bool(k, v) ? "" : NULL;
731
- return 0;
732
- }
733
-
734
- return git_gpg_config(k, v, NULL);
735
-}
736
-
748
static int rest_is_empty(const struct strbuf *sb, int start)
749
{
750
int i, eol;
1050
struct strbuf err = STRBUF_INIT;
1051
struct strbuf amend_msg = STRBUF_INIT;
1052
char *amend_author = NULL;
1042
- const char *gpg_sign;
1053
enum commit_msg_cleanup_mode cleanup;
1054
int res = 0;
1055
1082
}
1083
1084
cleanup = (flags & CLEANUP_MSG) ? COMMIT_MSG_CLEANUP_ALL :
1075
- default_msg_cleanup;
1085
+ opts->default_msg_cleanup;
1086
+
1087
if (cleanup != COMMIT_MSG_CLEANUP_NONE)
1088
strbuf_stripspace(msg, cleanup == COMMIT_MSG_CLEANUP_ALL);
1089
if (!opts->allow_empty_message && message_is_empty(msg, cleanup)) {
1091
goto out;
1092
}
1093
1083
- gpg_sign = opts->gpg_sign ? opts->gpg_sign : default_gpg_sign;
1084
-
1094
if (write_cache_as_tree(tree.hash, 0, NULL)) {
1095
res = error(_("git write-tree failed to write a tree"));
1096
goto out;
1104
}
1105
1106
if (commit_tree_extended(msg->buf, msg->len, tree.hash, parents,
1098
- oid->hash, author, gpg_sign, extra)) {
1107
+ oid->hash, author, opts->gpg_sign, extra)) {
1108
res = error(_("failed to write commit object"));
1109
goto out;
1110
}