# [PATCH QGit 3/4] Avoid submenus with merely 1 entry

1 messages from 2009-06-06 to 2009-06-06. Participants: Markus Heidelberg.
Thread: https://gitlist.dev/t/19714

## Markus Heidelberg, 2009-06-06 11:57

Subject: [PATCH QGit 3/4] Avoid submenus with merely 1 entry
Message-ID: <1244289471-698-4-git-send-email-markus.heidelberg@web.de>
URL: https://gitlist.dev/e/1244289471-698-4-git-send-email-markus.heidelberg%40web.de

```
Display the branch/tag in the main context menu in these cases, where
only the last branch/tag would go into a submenu.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 src/mainimpl.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mainimpl.cpp b/src/mainimpl.cpp
index 24b4ef1..38bbfbe 100644
--- a/src/mainimpl.cpp
+++ b/src/mainimpl.cpp
@@ -1197,7 +1197,8 @@ void MainImpl::doContexPopup(SCRef sha) {
 			contextMenu.addSeparator();
 
 		FOREACH_SL (it, bn) {
-			if (cntMenuEntries(contextMenu) < MAX_MENU_ENTRIES)
+			if (cntMenuEntries(contextMenu) < MAX_MENU_ENTRIES
+					|| (*it == bn.last() && contextSubMenu.isEmpty() && tn.empty()))
 				act = contextMenu.addAction(*it);
 			else
 				act = contextSubMenu.addAction(*it);
@@ -1211,7 +1212,8 @@ void MainImpl::doContexPopup(SCRef sha) {
 				contextMenu.addSeparator();
 
 		FOREACH_SL (it, tn) {
-			if (cntMenuEntries(contextMenu) < MAX_MENU_ENTRIES)
+			if (cntMenuEntries(contextMenu) < MAX_MENU_ENTRIES
+					|| (*it == tn.last() && contextSubMenu.isEmpty()))
 				act = contextMenu.addAction(*it);
 			else
 				act = contextSubMenu.addAction(*it);
-- 
1.6.3.2.213.g30b07

```
