Skip to content

Compare References Fails When Same Comparison Made in Two Different Repos #4742

@grantemj

Description

@grantemj

Description

Comparing References fails if the same reference-to-reference comparison is selected for two different git repositories in a vscode workspace.

Environment

  • VSCode workspace with multiple git repositories
  • Search & Compare separated into the GitLens Inspect tab (rather than the Source Control tab)

Action attempted

  • New Search or Compare
    • Compare References...
    • Repo selected = repo_A
    • Reference 1 selected = master (branch name)
    • Reference 2 selected = dev (branch name)
  • New Search or Compare
    • Compare References...
    • Repo selected = repo_B
    • Reference 1 selected = master (branch name)
    • Reference 2 selected = dev (branch name)

Note: This error occurs no matter the specific references nor repos, as long as the two references chosen share the same exact names between the two requests.

Error

After second "New Search or Compare" added, the following error pops up.

Element with id gitlens://searchAndCompare/compare-results/comparison/+dev is already registered

Additionally, all entries under the SEARCH & COMPARE tab/view disappear. User must "Clear Results" and start over in order to clear the error and use this feature again as usual.

Expected result

The SEARCH & COMPARE feature should be able to handle the results of these two separate requests just like any other

Suspected Fix

It appears as though the different results are kept track of via IDs that only take into account the two reference points. Therefore even with two different repositories, if the same exact references are selected, the IDs clash.

If the repo name itself is included in the ID, this collision should not occur.

(This is a casual guess based off of no knowledge of the inner workings of this feature of this extension.)

GitLens Version

17.6.2

VS Code Version

Version: 1.105.1 (system setup)
Commit: 7d842fb85a0275a4a8e4d7e040d2625abbf7f084
Date: 2025-10-14T22:33:36.618Z
Electron: 37.6.0
ElectronBuildId: 12502201
Chromium: 138.0.7204.251
Node.js: 22.19.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26100

Git Version

git version 2.51.2.windows.1

Logs, Screenshots, Screen Captures, etc

Element with id gitlens://searchAndCompare/compare-results/comparison/+dev is already registered

gitlens_searchAndCompare_output_3.log

Changes made to the log:

  • Replaced the names of some folder / repo references

Attempted Reference Comparisons shown in log:

  • repo_A then repo_B: master .. dev
  • repo_B then repo_A: Working Tree .. dev
  • repo_A then repo_B: HEAD .. serial_manager

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-verificationRequest for verificationpending-releaseResolved but not yet released to the stable edition

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions