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