commit d8d7496e93d9bc3da67d5a4b39097becd5a12390
Author: Scott Kostyshak <skost...@lyx.org>
Date:   Mon Mar 24 13:08:44 2025 +0100

    Debug msg if adding existing branch in container
    
    It is probably better to handle these cases at a higher level, as
    was just done at 7d1eea03.
    
    I will not be surprised if there is a case (that I am not currently
    aware of) where it is actually ideal to handle this case in this
    low-level add() method.
    
    For now, this reports an error as a debug message. Eventually I
    would like to change this to an assert.
---
 src/BranchList.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/BranchList.cpp b/src/BranchList.cpp
index d9409c80f1..2b74802822 100644
--- a/src/BranchList.cpp
+++ b/src/BranchList.cpp
@@ -19,6 +19,7 @@
 
 #include "support/convert.h"
 #include "support/lstrings.h"
+#include "support/debug.h"
 
 #include <algorithm>
 
@@ -169,6 +170,19 @@ bool BranchList::add(docstring const & s)
                        name = s.substr(i, j - i);
                // Is this name already in the list?
                bool const already = find(name);
+               //
+               // Not necessarily a problem, but these cases should probably
+               // be handled in the GUI (e.g., 7d1eea03).
+               // For now, I will put a terminal message. But eventually
+               // I would like to use an assert instead:
+               //   LASSERT(!already, /**/);
+               // \scott
+               if (already) {
+                       LYXERR0("Error: attempt to add branch that already 
exists: '"
+                               << name
+                               << "'. Please report this use case.");
+               }
+               //
                if (!already) {
                        added = true;
                        Branch br;
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to