@@ -300,12 +300,12 @@ QModelIndex DoubleTreeWidget::selectedIndex() const {
300
300
}
301
301
302
302
static void addNodeToMenu (const git::Index &index, QStringList &files,
303
- const Node *node, bool staged) {
303
+ const Node *node, bool staged, bool statusDiff ) {
304
304
qDebug () << " DoubleTreeWidgetr addNodeToMenu()" << node->name ();
305
305
306
306
if (node->hasChildren ()) {
307
307
for (auto child : node->children ()) {
308
- addNodeToMenu (index , files, child, staged);
308
+ addNodeToMenu (index , files, child, staged, statusDiff );
309
309
}
310
310
311
311
} else {
@@ -314,7 +314,7 @@ static void addNodeToMenu(const git::Index &index, QStringList &files,
314
314
auto stageState = index .isStaged (path);
315
315
316
316
if ((staged && stageState != git::Index::Unstaged) ||
317
- !staged && stageState != git::Index::Staged) {
317
+ ( !staged && stageState != git::Index::Staged) || !statusDiff ) {
318
318
files.append (path);
319
319
}
320
320
}
@@ -324,10 +324,15 @@ void DoubleTreeWidget::showFileContextMenu(const QPoint &pos, RepoView *view,
324
324
QTreeView *tree, bool staged) {
325
325
QStringList files;
326
326
QModelIndexList indexes = tree->selectionModel ()->selectedIndexes ();
327
+ const auto diff = view->diff ();
328
+ if (!diff.isValid ())
329
+ return ;
330
+
331
+ const bool statusDiff = diff.isStatusDiff ();
327
332
foreach (const QModelIndex &index , indexes) {
328
333
auto node = index .data (Qt::UserRole).value <Node *>();
329
334
330
- addNodeToMenu (view->repo ().index (), files, node, staged);
335
+ addNodeToMenu (view->repo ().index (), files, node, staged, statusDiff );
331
336
}
332
337
333
338
if (files.isEmpty ())
0 commit comments