Skip to content

issue #7520 : fix MissingObjectException when switching git projects#7531

Merged
hansva merged 1 commit into
apache:mainfrom
mattcasters:issue-7520
Jul 16, 2026
Merged

issue #7520 : fix MissingObjectException when switching git projects#7531
hansva merged 1 commit into
apache:mainfrom
mattcasters:issue-7520

Conversation

@mattcasters

Copy link
Copy Markdown
Contributor

What

Fixes org.eclipse.jgit.errors.MissingObjectException in the Git Perspective when switching Hop projects (or explorer roots) that map to different local git repositories.

Root cause

The Git Perspective is a long-lived singleton. On project switch it opened the new repository and then called updateGui() while the history table still held RevCommit selection from the previous repo. isCommitInCurrentBranch re-parsed those ids against the newly opened object database → Missing unknown <other-project-SHA>.

This is a 2.18 Git Perspective lifecycle bug, not a general JGit inability to read commit-graph / multi-pack-index / bitmaps. See the analysis on #7520.

Changes

  • A: Clear ref/history/file UI state first on refresh; rebuild for the current repo; call updateGui() last.
  • B: Close the previous UIGit repository on rootChanged (null-safe closeRepo()).
  • C: Harden branch membership check: objectDatabase.has(id) / quiet MissingObjectException for foreign ids.
  • Small headless JGit unit test for the branch-check helper (two temp repos; no native git, no SWT).

How was this tested?

  • ./mvnw -pl plugins/misc/git -am test -Dtest=GitPerspectiveBranchCheckTest -Dsurefire.failIfNoSpecifiedTests=false
  • Compile of the git plugin module

Related

Fixes #7520

…jects

Clear Git Perspective UI state before rebuild on root change, close the
previous JGit repository when opening another, and treat foreign commit
ids as not-in-branch instead of logging MissingObjectException.
@hansva

hansva commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Going to keep this open until we have a reply in #7520, as I do not have the correct setup to properly test this fix.

@mattcasters
mattcasters marked this pull request as draft July 15, 2026 13:11
@mattcasters

Copy link
Copy Markdown
Contributor Author

Set to draft until we have confirmation.

@hansva
hansva marked this pull request as ready for review July 16, 2026 08:57
@hansva

hansva commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Merging as he can't test on code only, this way he will have a snapshot build

@hansva
hansva merged commit 6e475d1 into apache:main Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: JGit MissingObjectException in Hop 2.18.1 (Regression from 2.17.0) due to native Git index formats

2 participants