summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-11-30 14:45:08 -0800
committerJunio C Hamano <gitster@pobox.com>2009-11-30 14:45:08 -0800
commit045c05048530b8c57c410886e5f64d91a44c2c83 (patch)
treeab68728e79a4e97bb16fe0bedbf9468daeaed585 /merge-recursive.c
parent22c4e72d6eef8295a3311f6eb2f82a5494f8b88e (diff)
parente2ced7de19c85f3b246480bfacdcc934c98c08ca (diff)
downloadgit-045c05048530b8c57c410886e5f64d91a44c2c83.tar.gz
Merge branch 'mm/maint-merge-ff-error-message-fix'
Conflicts: merge-recursive.c
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index a91208f295..dd4fbd0e6b 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -172,23 +172,6 @@ static int git_merge_trees(int index_only,
int rc;
struct tree_desc t[3];
struct unpack_trees_options opts;
- struct unpack_trees_error_msgs msgs = {
- /* would_overwrite */
- "Your local changes to '%s' would be overwritten by merge. Aborting.",
- /* not_uptodate_file */
- "Your local changes to '%s' would be overwritten by merge. Aborting.",
- /* not_uptodate_dir */
- "Updating '%s' would lose untracked files in it. Aborting.",
- /* would_lose_untracked */
- "Untracked working tree file '%s' would be %s by merge. Aborting",
- /* bind_overlap -- will not happen here */
- NULL,
- };
- if (advice_commit_before_merge) {
- msgs.would_overwrite = msgs.not_uptodate_file =
- "Your local changes to '%s' would be overwritten by merge. Aborting.\n"
- "Please, commit your changes or stash them before you can merge.";
- }
memset(&opts, 0, sizeof(opts));
if (index_only)
@@ -200,7 +183,7 @@ static int git_merge_trees(int index_only,
opts.fn = threeway_merge;
opts.src_index = &the_index;
opts.dst_index = &the_index;
- opts.msgs = msgs;
+ opts.msgs = get_porcelain_error_msgs();
init_tree_desc_from_tree(t+0, common);
init_tree_desc_from_tree(t+1, head);
@@ -1188,6 +1171,28 @@ static int process_entry(struct merge_options *o,
return clean_merge;
}
+struct unpack_trees_error_msgs get_porcelain_error_msgs(void)
+{
+ struct unpack_trees_error_msgs msgs = {
+ /* would_overwrite */
+ "Your local changes to '%s' would be overwritten by merge. Aborting.",
+ /* not_uptodate_file */
+ "Your local changes to '%s' would be overwritten by merge. Aborting.",
+ /* not_uptodate_dir */
+ "Updating '%s' would lose untracked files in it. Aborting.",
+ /* would_lose_untracked */
+ "Untracked working tree file '%s' would be %s by merge. Aborting",
+ /* bind_overlap -- will not happen here */
+ NULL,
+ };
+ if (advice_commit_before_merge) {
+ msgs.would_overwrite = msgs.not_uptodate_file =
+ "Your local changes to '%s' would be overwritten by merge. Aborting.\n"
+ "Please, commit your changes or stash them before you can merge.";
+ }
+ return msgs;
+}
+
int merge_trees(struct merge_options *o,
struct tree *head,
struct tree *merge,