summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2009-11-29 12:18:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-11-30 07:52:31 (GMT)
commit264b774ba6b27cc07ef4c33d52e491d9abf029bb (patch)
tree49d67bd2fd3d6167733c85f3449c97684e64b13f /merge-recursive.c
parent78d553b7d7b269bb22ebd8b1198657c37484a3a0 (diff)
downloadgit-264b774ba6b27cc07ef4c33d52e491d9abf029bb.zip
git-264b774ba6b27cc07ef4c33d52e491d9abf029bb.tar.gz
git-264b774ba6b27cc07ef4c33d52e491d9abf029bb.tar.bz2
merge-recursive: make the error-message generation an extern function
The construction of the struct unpack_trees_error_msgs was done within git_merge_trees(), which prevented using the same messages easily from another function. [jc: backported for 1.6.5 maint before advice_commit_before_merge] Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index f55b7eb..72bfbaf 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -170,18 +170,6 @@ static int git_merge_trees(int index_only,
int rc;
struct tree_desc t[3];
struct unpack_trees_options opts;
- static const 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,
- };
memset(&opts, 0, sizeof(opts));
if (index_only)
@@ -193,7 +181,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);
@@ -1180,6 +1168,23 @@ 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,
+ };
+ return msgs;
+}
+
int merge_trees(struct merge_options *o,
struct tree *head,
struct tree *merge,