From 951f1ed4ed642faf8b390a5ad910eb840c992553 Mon Sep 17 00:00:00 2001
From: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Date: Thu, 29 Mar 2018 08:27:56 -0700
Subject: [PATCH] Add a comment to clarify subtle branch in node_copy_tree

---
 src/pugixml.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index bf3346b7..d1404252 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -4423,6 +4423,7 @@ PUGI__NS_BEGIN
 
 		while (sit && sit != sn)
 		{
+			// when a tree is copied into one of the descendants, we need to skip that subtree to avoid an infinite loop
 			if (sit != dn)
 			{
 				xml_node_struct* copy = append_new_node(dit, alloc, PUGI__NODETYPE(sit));
-- 
GitLab