Skip to content

[NBug] Sequence contains more than one matching element #12464

@VolovarMartin

Description

@VolovarMartin

Environment

  • Git Extensions 5.2.1.18061
  • Build 0d74cfd
  • Git 2.47.1.windows.1
  • Microsoft Windows NT 10.0.26100.0
  • .NET 8.0.14
  • DPI 120dpi (125% scaling)
  • Portable: False

Issue description

System.InvalidOperationException: Sequence contains more than one matching element
   at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
   at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at GitUI.CommandsDialogs.RevisionFileTreeController.FindSubNode(TreeNodeCollection nodes, Queue`1 pathParts) in C:\projects\gitextensions\src\app\GitUI\CommandsDialogs\RevisionFileTreeController.cs:line 166
   at GitUI.CommandsDialogs.RevisionFileTreeController.SelectFileOrFolder(NativeTreeView tree, String fileSubPath) in C:\projects\gitextensions\src\app\GitUI\CommandsDialogs\RevisionFileTreeController.cs:line 149
   at GitUI.CommandsDialogs.RevisionFileTreeControl.LoadRevision(GitRevision revision) in C:\projects\gitextensions\src\app\GitUI\CommandsDialogs\RevisionFileTreeControl.cs:line 231
   at GitUI.CommandsDialogs.FormBrowse.FillFileTree(GitRevision revision) in C:\projects\gitextensions\src\app\GitUI\CommandsDialogs\FormBrowse.cs:line 1230
   at GitUI.CommandsDialogs.FormBrowse.RefreshSelection() in C:\projects\gitextensions\src\app\GitUI\CommandsDialogs\FormBrowse.cs:line 741
   at GitUI.CommandsDialogs.FormBrowse.CommitInfoTabControl_SelectedIndexChanged(Object sender, EventArgs e) in C:\projects\gitextensions\src\app\GitUI\CommandsDialogs\FormBrowse.cs:line 1574
   at System.Windows.Forms.TabControl.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.TabControl.WmSelChange()
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

I clicked on "File tree" for the selected file and it says "Sequence contains more than one matching element". It was my fault, I have some files starting with the space character in my repository.

Steps to reproduce

  1. Create a random file (e.g. "a.txt")
  2. Create a file with the same name and put the space character at the beginning (e.g. " a.txt")
  3. Commit these files
  4. Open "File Tree" for one of these files

Did this work in previous version of GitExtensions?

No response

Diagnostics

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions