You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/06/28 23:40:15 UTC
svn commit: r1355167 - /subversion/trunk/subversion/libsvn_wc/conflicts.c
Author: rhuijben
Date: Thu Jun 28 21:40:13 2012
New Revision: 1355167
URL: http://svn.apache.org/viewvc?rev=1355167&view=rev
Log:
Ensure that we don't set an operation on a conflict skel twice, by asserting
that no operation is set before storing the operation details.
Suggested by: gstein
* subversion/libsvn_wc/conflicts.c
(conflict__get_operation): New function.
(svn_wc__conflict_skel_set_op_update,
svn_wc__conflict_skel_set_op_switch,
svn_wc__conflict_skel_set_op_merge): Verify that conflict__get_operation
returns NULL before setting the operation.
Modified:
subversion/trunk/subversion/libsvn_wc/conflicts.c
Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1355167&r1=1355166&r2=1355167&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Thu Jun 28 21:40:13 2012
@@ -134,6 +134,26 @@ conflict__prepend_location(svn_skel_t *s
return SVN_NO_ERROR;
}
+/* Get the operation part of CONFLICT_SKELL or NULL if no operation is set
+ at this time */
+static svn_error_t *
+conflict__get_operation(svn_skel_t **why,
+ svn_skel_t *conflict_skel)
+{
+ SVN_ERR_ASSERT(conflict_skel
+ && conflict_skel->children
+ && conflict_skel->children->next
+ && !conflict_skel->children->next->is_atom);
+
+ *why = conflict_skel->children;
+
+ if (!(*why)->children)
+ *why = NULL; /* Operation is not set yet */
+
+ return SVN_NO_ERROR;
+}
+
+
svn_error_t *
svn_wc__conflict_skel_set_op_update(svn_skel_t *conflict_skel,
const svn_wc_conflict_version_t *original,
@@ -148,6 +168,9 @@ svn_wc__conflict_skel_set_op_update(svn_
&& conflict_skel->children->next
&& !conflict_skel->children->next->is_atom);
+ SVN_ERR(conflict__get_operation(&why, conflict_skel));
+
+ SVN_ERR_ASSERT(why == NULL); /* No operation set */
why = conflict_skel->children;
@@ -176,6 +199,9 @@ svn_wc__conflict_skel_set_op_switch(svn_
&& conflict_skel->children->next
&& !conflict_skel->children->next->is_atom);
+ SVN_ERR(conflict__get_operation(&why, conflict_skel));
+
+ SVN_ERR_ASSERT(why == NULL); /* No operation set */
why = conflict_skel->children;
@@ -205,6 +231,9 @@ svn_wc__conflict_skel_set_op_merge(svn_s
&& conflict_skel->children->next
&& !conflict_skel->children->next->is_atom);
+ SVN_ERR(conflict__get_operation(&why, conflict_skel));
+
+ SVN_ERR_ASSERT(why == NULL); /* No operation set */
why = conflict_skel->children;