@@ -172,23 +172,6 @@ static int git_merge_trees(int index_only,
172
172
int rc ;
173
173
struct tree_desc t [3 ];
174
174
struct unpack_trees_options opts ;
175
- struct unpack_trees_error_msgs msgs = {
176
- /* would_overwrite */
177
- "Your local changes to '%s' would be overwritten by merge. Aborting." ,
178
- /* not_uptodate_file */
179
- "Your local changes to '%s' would be overwritten by merge. Aborting." ,
180
- /* not_uptodate_dir */
181
- "Updating '%s' would lose untracked files in it. Aborting." ,
182
- /* would_lose_untracked */
183
- "Untracked working tree file '%s' would be %s by merge. Aborting" ,
184
- /* bind_overlap -- will not happen here */
185
- NULL ,
186
- };
187
- if (advice_commit_before_merge ) {
188
- msgs .would_overwrite = msgs .not_uptodate_file =
189
- "Your local changes to '%s' would be overwritten by merge. Aborting.\n"
190
- "Please, commit your changes or stash them before you can merge." ;
191
- }
192
175
193
176
memset (& opts , 0 , sizeof (opts ));
194
177
if (index_only )
@@ -200,7 +183,7 @@ static int git_merge_trees(int index_only,
200
183
opts .fn = threeway_merge ;
201
184
opts .src_index = & the_index ;
202
185
opts .dst_index = & the_index ;
203
- opts .msgs = msgs ;
186
+ opts .msgs = get_porcelain_error_msgs () ;
204
187
205
188
init_tree_desc_from_tree (t + 0 , common );
206
189
init_tree_desc_from_tree (t + 1 , head );
@@ -1188,6 +1171,28 @@ static int process_entry(struct merge_options *o,
1188
1171
return clean_merge ;
1189
1172
}
1190
1173
1174
+ struct unpack_trees_error_msgs get_porcelain_error_msgs (void )
1175
+ {
1176
+ struct unpack_trees_error_msgs msgs = {
1177
+ /* would_overwrite */
1178
+ "Your local changes to '%s' would be overwritten by merge. Aborting." ,
1179
+ /* not_uptodate_file */
1180
+ "Your local changes to '%s' would be overwritten by merge. Aborting." ,
1181
+ /* not_uptodate_dir */
1182
+ "Updating '%s' would lose untracked files in it. Aborting." ,
1183
+ /* would_lose_untracked */
1184
+ "Untracked working tree file '%s' would be %s by merge. Aborting" ,
1185
+ /* bind_overlap -- will not happen here */
1186
+ NULL ,
1187
+ };
1188
+ if (advice_commit_before_merge ) {
1189
+ msgs .would_overwrite = msgs .not_uptodate_file =
1190
+ "Your local changes to '%s' would be overwritten by merge. Aborting.\n"
1191
+ "Please, commit your changes or stash them before you can merge." ;
1192
+ }
1193
+ return msgs ;
1194
+ }
1195
+
1191
1196
int merge_trees (struct merge_options * o ,
1192
1197
struct tree * head ,
1193
1198
struct tree * merge ,
0 commit comments