[PATCH 5/9] merge-ort: make path_messages available to external callers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Elijah Newren <newren@xxxxxxxxx>

merge-ort is designed to be more flexible so that it could be called as
more of a library function.  Part of that design is not writing to the
working tree or index unless and until requested.  Part of it is
returning tree objects (rather than creating commits and making them
part of HEAD), and allowing callers to do their own special thing with
that merged tree.  Along the same lines, we want to enable callers to do
something special with output messages (conflicts and other warnings)
besides just automatically displaying on stdout/stderr.  Do so by making
the output path messages accessible via a new member of struct
merge_result named path_messages.

Signed-off-by: Elijah Newren <newren@xxxxxxxxx>
---
 merge-ort.c |  1 +
 merge-ort.h | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/merge-ort.c b/merge-ort.c
index fe27870e73e..c4d6c5c81cc 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -4547,6 +4547,7 @@ redo:
 	trace2_region_leave("merge", "process_entries", opt->repo);
 
 	/* Set return values */
+	result->path_messages = &opt->priv->output;
 	result->tree = parse_tree_indirect(&working_tree_oid);
 	/* existence of conflicted entries implies unclean */
 	result->clean &= strmap_empty(&opt->priv->conflicted);
diff --git a/merge-ort.h b/merge-ort.h
index c011864ffeb..fe599b87868 100644
--- a/merge-ort.h
+++ b/merge-ort.h
@@ -5,6 +5,7 @@
 
 struct commit;
 struct tree;
+struct strmap;
 
 struct merge_result {
 	/*
@@ -23,6 +24,15 @@ struct merge_result {
 	 */
 	struct tree *tree;
 
+	/*
+	 * Special messages and conflict notices for various paths
+	 *
+	 * This is a map of pathnames to strbufs.  It contains various
+	 * warning/conflict/notice messages (possibly multiple per path)
+	 * that callers may want to use.
+	 */
+	struct strmap *path_messages;
+
 	/*
 	 * Additional metadata used by merge_switch_to_result() or future calls
 	 * to merge_incore_*().  Includes data needed to update the index (if
-- 
gitgitgadget




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux