Source:
<code>private void fillTreeItemWithGitDirectory(RepositoryMapping m, TreeItem treeItem2, boolean isAlternative) { if (m.getGitDir() == null) treeItem2.setText(2, UIText.ExistingOrNewPage_SymbolicValueEmptyMapping); else { IPath container = m.getContainerPath(); if (!container.isEmpty()) container = Path.fromOSString("."); IPath relativePath = container.append(m.getGitDir()); if (isAlternative) { IPath withoutLastSegment = relativePath.removeLastSegments(1); IPath path; if (withoutLastSegment.isEmpty()) path = Path.fromPortableString("."); else path = withoutLastSegment; treeItem2.setText(0, path.toString()); } treeItem2.setText(2, relativePath.toString()); try { IProject project = m.getContainer().getProject(); FileRepository repo = new FileRepository(m.getGitDirAbsolutePath().toFile()); File workTree = repo.getWorkTree(); IPath workTreePath = Path.fromOSString(workTree.getAbsolutePath()); if (workTreePath.isPrefixOf(project.getLocation())) { IPath makeRelativeTo = project.getLocation().makeRelativeTo(workTreePath); String repoRelativePath = makeRelativeTo.append("/.project").toPortableString(); <START> ObjectId headComitId = repo.resolve(Constants.HEAD); <END> if (headComitId != null) { RevWalk revWalk = new RevWalk(repo); RevCommit headCommit = revWalk.parseCommit(headComitId); RevTree headTree = headCommit.getTree(); TreeWalk projectInRepo = TreeWalk.forPath(repo, repoRelativePath, headTree); if (projectInRepo != null) { treeItem2.setChecked(true); } revWalk.dispose(); } } repo.close(); } catch (IOException e1) { Activator.logError("Failed to detect which repository to use", e1); } } }</code><technical_language>typo: s/headComitId/headCommitId/</technical_language>

Target:
private void fillTreeItemWithGitDirectory(RepositoryMapping m, TreeItem treeItem2, boolean isAlternative) { if (m.getGitDir() == null) treeItem2.setText(2, UIText.ExistingOrNewPage_SymbolicValueEmptyMapping); else { IPath container = m.getContainerPath(); if (!container.isEmpty()) container = Path.fromOSString("."); IPath relativePath = container.append(m.getGitDir()); if (isAlternative) { IPath withoutLastSegment = relativePath.removeLastSegments(1); IPath path; if (withoutLastSegment.isEmpty()) path = Path.fromPortableString("."); else path = withoutLastSegment; treeItem2.setText(0, path.toString()); } treeItem2.setText(2, relativePath.toString()); try { IProject project = m.getContainer().getProject(); FileRepository repo = new FileRepository(m.getGitDirAbsolutePath().toFile()); File workTree = repo.getWorkTree(); IPath workTreePath = Path.fromOSString(workTree.getAbsolutePath()); if (workTreePath.isPrefixOf(project.getLocation())) { IPath makeRelativeTo = project.getLocation().makeRelativeTo(workTreePath); String repoRelativePath = makeRelativeTo.append("/.project").toPortableString(); ObjectId headCommitId = repo.resolve(Constants.HEAD); if (headCommitId != null) { RevWalk revWalk = new RevWalk(repo); RevCommit headCommit = revWalk.parseCommit(headCommitId); RevTree headTree = headCommit.getTree(); TreeWalk projectInRepo = TreeWalk.forPath(repo, repoRelativePath, headTree); if (projectInRepo != null) { treeItem2.setChecked(true); } revWalk.dispose(); } } repo.close(); } catch (IOException e1) { Activator.logError("Failed to detect which repository to use", e1); } } }