Source:
public static StyledString getStyledLabel(Repository repository) throws IOException { RepositoryUtil repositoryUtil = Activator.getDefault() .getRepositoryUtil(); StyledString string = new StyledString(); IndexDiffData indexDiffData = org.eclipse.egit.core.Activator .getDefault().getIndexDiffCache() .getIndexDiffCacheEntry(repository).getIndexDiff(); if (indexDiffData != null && (!indexDiffData.getAdded().isEmpty() || !indexDiffData.getChanged().isEmpty() || !indexDiffData.getRemoved().isEmpty() || !indexDiffData.getUntracked().isEmpty() || !indexDiffData.getModified().isEmpty() || !indexDiffData .getMissing().isEmpty())) { string.append('>'); string.append(' '); } string.append(repositoryUtil.getRepositoryName(repository)); String branch = repositoryUtil.getShortBranch(repository); if (branch != null) { string.append(' '); string.append('[', StyledString.DECORATIONS_STYLER); string.append(branch, StyledString.DECORATIONS_STYLER); BranchTrackingStatus trackingStatus = BranchTrackingStatus.of( repository, branch); if (trackingStatus != null && (trackingStatus.getAheadCount() != 0 || trackingStatus .getBehindCount() != 0)) { String formattedTrackingStatus = GitLabels .formatBranchTrackingStatus(trackingStatus); string.append(' '); string.append(formattedTrackingStatus, StyledString.DECORATIONS_STYLER); } RepositoryState repositoryState = repository.getRepositoryState(); if (repositoryState != RepositoryState.SAFE) { string.append(" - ", StyledString.DECORATIONS_STYLER); string.append(repositoryState.getDescription(), StyledString.DECORATIONS_STYLER); } string.append(']', StyledString.DECORATIONS_STYLER); } return string; }

Target:
public static StyledString getStyledLabel(Repository repository) throws IOException { RepositoryUtil repositoryUtil = Activator.getDefault() .getRepositoryUtil(); StyledString string = new StyledString(); IndexDiffCacheEntry entry = org.eclipse.egit.core.Activator .getDefault().getIndexDiffCache() .getIndexDiffCacheEntry(repository); if (entry != null) { IndexDiffData indexDiffData = entry.getIndexDiff(); if (indexDiffData != null && (!indexDiffData.getAdded().isEmpty() || !indexDiffData.getChanged().isEmpty() || !indexDiffData.getRemoved().isEmpty() || !indexDiffData.getUntracked().isEmpty() || !indexDiffData.getModified().isEmpty() || !indexDiffData.getMissing().isEmpty())) { string.append('>'); string.append(' '); } } string.append(repositoryUtil.getRepositoryName(repository)); String branch = repositoryUtil.getShortBranch(repository); if (branch != null) { string.append(' '); string.append('[', StyledString.DECORATIONS_STYLER); string.append(branch, StyledString.DECORATIONS_STYLER); BranchTrackingStatus trackingStatus = BranchTrackingStatus.of( repository, branch); if (trackingStatus != null && (trackingStatus.getAheadCount() != 0 || trackingStatus .getBehindCount() != 0)) { String formattedTrackingStatus = GitLabels .formatBranchTrackingStatus(trackingStatus); string.append(' '); string.append(formattedTrackingStatus, StyledString.DECORATIONS_STYLER); } RepositoryState repositoryState = repository.getRepositoryState(); if (repositoryState != RepositoryState.SAFE) { string.append(" - ", StyledString.DECORATIONS_STYLER); string.append(repositoryState.getDescription(), StyledString.DECORATIONS_STYLER); } string.append(']', StyledString.DECORATIONS_STYLER); } return string; }