nus-yam/ex-repair huggingface dataset:
Program: 91397
Project: 91397
Buggy source:
/** 
 * Creates a grid layout with the specified number of columns and the standard spacings.
 * @param numColumns the number of columns
 * @param converter the pixel converter
 * @param margins one of <code>MARGINS_DEFAULT</code>, <code>MARGINS_NONE</code> or <code>MARGINS_DIALOG</code>.
 * @return the created grid layout
 */
public static GridLayout createGridLayout(int numColumns,PixelConverter converter,int margins){
  Assert.isTrue(margins == MARGINS_DEFAULT || margins == MARGINS_NONE || margins == MARGINS_DIALOG);
  final GridLayout layout=new GridLayout(numColumns,false);
  layout.horizontalSpacing=converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
  layout.verticalSpacing=converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
switch (margins) {
case MARGINS_NONE:
    layout.marginLeft=layout.marginRight=0;
  layout.marginTop=layout.marginBottom=0;
break;
case MARGINS_DIALOG:
layout.marginLeft=layout.marginRight=converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.marginTop=layout.marginBottom=converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
break;
case MARGINS_DEFAULT:
layout.marginLeft=layout.marginRight=layout.marginWidth;
layout.marginTop=layout.marginBottom=layout.marginHeight;
}
layout.marginWidth=layout.marginHeight=0;
return layout;
}

Fixed version (ground truth):
/** 
 * Creates a grid layout with the specified number of columns and the standard spacings.
 * @param numColumns the number of columns
 * @param converter the pixel converter
 * @param margins one of <code>MARGINS_DEFAULT</code>, <code>MARGINS_NONE</code> or <code>MARGINS_DIALOG</code>.
 * @return the created grid layout
 */
public static GridLayout createGridLayout(int numColumns,PixelConverter converter,int margins){
  Assert.isTrue(margins == MARGINS_DEFAULT || margins == MARGINS_NONE || margins == MARGINS_DIALOG);
  final GridLayout layout=new GridLayout(numColumns,false);
  layout.horizontalSpacing=converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
  layout.verticalSpacing=converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
switch (margins) {
case MARGINS_NONE:
    layout.marginLeft=layout.marginRight=0;
  layout.marginTop=layout.marginBottom=0;
break;
case MARGINS_DIALOG:
layout.marginLeft=layout.marginRight=converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.marginTop=layout.marginBottom=converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
break;
case MARGINS_DEFAULT:
layout.marginLeft=layout.marginRight=layout.marginWidth;
layout.marginTop=layout.marginBottom=layout.marginHeight;
break;
default :
break;
}
layout.marginWidth=layout.marginHeight=0;
return layout;
}
Program: 91398
Project: 91398
Buggy source:
@Override protected void buttonPressed(int buttonId){
switch (buttonId) {
case IDialogConstants.PROCEED_ID:
    CommitUI commitUI=new CommitUI(getShell(),repository,new IResource[0],true);
  shouldContinue=commitUI.commit();
break;
case IDialogConstants.ABORT_ID:
final ResetOperation operation=new ResetOperation(repository,Constants.HEAD,ResetType.HARD);
String jobname=NLS.bind(UIText.ResetAction_reset,Constants.HEAD);
JobUtil.scheduleUserWorkspaceJob(operation,jobname,JobFamilies.RESET);
shouldContinue=true;
break;
case IDialogConstants.SKIP_ID:
StashCreateUI stashCreateUI=new StashCreateUI(repository);
shouldContinue=stashCreateUI.createStash(getShell());
break;
case IDialogConstants.CANCEL_ID:
}
super.buttonPressed(buttonId);
}

Fixed version (ground truth):
@Override protected void buttonPressed(int buttonId){
switch (buttonId) {
case IDialogConstants.PROCEED_ID:
    CommitUI commitUI=new CommitUI(getShell(),repository,new IResource[0],true);
  shouldContinue=commitUI.commit();
break;
case IDialogConstants.ABORT_ID:
final ResetOperation operation=new ResetOperation(repository,Constants.HEAD,ResetType.HARD);
String jobname=NLS.bind(UIText.ResetAction_reset,Constants.HEAD);
JobUtil.scheduleUserWorkspaceJob(operation,jobname,JobFamilies.RESET);
shouldContinue=true;
break;
case IDialogConstants.SKIP_ID:
StashCreateUI stashCreateUI=new StashCreateUI(repository);
shouldContinue=stashCreateUI.createStash(getShell());
break;
case IDialogConstants.CANCEL_ID:
default :
break;
}
super.buttonPressed(buttonId);
}
Program: 91400
Project: 91400
Buggy source:
private void decorateText(IDecoration decoration,IDecoratableResource resource){
  String format="String_Node_Str";
switch (resource.getType()) {
case IResource.FILE:
    format=store.getString(UIPreferences.DECORATOR_FILETEXT_DECORATION);
  break;
case IResource.FOLDER:
case DecoratableResourceMapping.RESOURCE_MAPPING:
if (resource.isRepositoryContainer()) {
  format=store.getString(UIPreferences.DECORATOR_SUBMODULETEXT_DECORATION);
}
 else {
  format=store.getString(UIPreferences.DECORATOR_FOLDERTEXT_DECORATION);
}
break;
case DecoratableResourceMapping.WORKING_SET:
if (resource.getRepositoryName() != null && resource.getBranch() != null) format=store.getString(UIPreferences.DECORATOR_PROJECTTEXT_DECORATION);
 else format=store.getString(UIPreferences.DECORATOR_FOLDERTEXT_DECORATION);
break;
case IResource.PROJECT:
format=store.getString(UIPreferences.DECORATOR_PROJECTTEXT_DECORATION);
break;
}
Map<String,String> bindings=new HashMap<>();
bindings.put(BINDING_RESOURCE_NAME,resource.getName());
bindings.put(BINDING_REPOSITORY_NAME,resource.getRepositoryName());
bindings.put(BINDING_BRANCH_NAME,resource.getBranch());
bindings.put(BINDING_BRANCH_STATUS,resource.getBranchStatus());
bindings.put(BINDING_DIRTY_FLAG,resource.isDirty() ? "String_Node_Str" : null);
bindings.put(BINDING_STAGED_FLAG,resource.isStaged() ? "String_Node_Str" : null);
bindings.put(BINDING_SHORT_MESSAGE,resource.getCommitMessage());
decorate(decoration,format,bindings);
}

Fixed version (ground truth):
private void decorateText(IDecoration decoration,IDecoratableResource resource){
  String format="String_Node_Str";
switch (resource.getType()) {
default :
case IResource.FILE:
    format=store.getString(UIPreferences.DECORATOR_FILETEXT_DECORATION);
  break;
case IResource.FOLDER:
case DecoratableResourceMapping.RESOURCE_MAPPING:
if (resource.isRepositoryContainer()) {
  format=store.getString(UIPreferences.DECORATOR_SUBMODULETEXT_DECORATION);
}
 else {
  format=store.getString(UIPreferences.DECORATOR_FOLDERTEXT_DECORATION);
}
break;
case DecoratableResourceMapping.WORKING_SET:
if (resource.getRepositoryName() != null && resource.getBranch() != null) format=store.getString(UIPreferences.DECORATOR_PROJECTTEXT_DECORATION);
 else format=store.getString(UIPreferences.DECORATOR_FOLDERTEXT_DECORATION);
break;
case IResource.PROJECT:
format=store.getString(UIPreferences.DECORATOR_PROJECTTEXT_DECORATION);
break;
}
Map<String,String> bindings=new HashMap<>();
bindings.put(BINDING_RESOURCE_NAME,resource.getName());
bindings.put(BINDING_REPOSITORY_NAME,resource.getRepositoryName());
bindings.put(BINDING_BRANCH_NAME,resource.getBranch());
bindings.put(BINDING_BRANCH_STATUS,resource.getBranchStatus());
bindings.put(BINDING_DIRTY_FLAG,resource.isDirty() ? "String_Node_Str" : null);
bindings.put(BINDING_STAGED_FLAG,resource.isStaged() ? "String_Node_Str" : null);
bindings.put(BINDING_SHORT_MESSAGE,resource.getCommitMessage());
decorate(decoration,format,bindings);
}
Program: 91401
Project: 91401
Buggy source:
@Override protected void buttonPressed(int buttonId){
switch (buttonId) {
case IDialogConstants.PROCEED_ID:
    CommonUtils.runCommand(ActionCommands.COMMIT_ACTION,new StructuredSelection(repository));
  break;
case IDialogConstants.ABORT_ID:
CommonUtils.runCommand(ResetCommand.ID,new StructuredSelection(new RepositoryNode(null,repository)));
break;
case IDialogConstants.SKIP_ID:
CommonUtils.runCommand(ActionCommands.STASH_CREATE,new StructuredSelection(new RepositoryNode(null,repository)));
break;
}
super.buttonPressed(buttonId);
}

Fixed version (ground truth):
@Override protected void buttonPressed(int buttonId){
switch (buttonId) {
case IDialogConstants.PROCEED_ID:
    CommonUtils.runCommand(ActionCommands.COMMIT_ACTION,new StructuredSelection(repository));
  break;
case IDialogConstants.ABORT_ID:
CommonUtils.runCommand(ResetCommand.ID,new StructuredSelection(new RepositoryNode(null,repository)));
break;
case IDialogConstants.SKIP_ID:
CommonUtils.runCommand(ActionCommands.STASH_CREATE,new StructuredSelection(new RepositoryNode(null,repository)));
break;
default :
break;
}
super.buttonPressed(buttonId);
}
Program: 91402
Project: 91402
Buggy source:
StorageSizeFieldEditor(String name,String labelText,Composite parent,int min,int max){
  init(name,labelText);
  setTextLimit(10);
  setEmptyStringAllowed(false);
  setErrorMessage(JFaceResources.getString("String_Node_Str"));
  createControl(parent);
  minValidValue=min;
  maxValidValue=max;
}

Fixed version (ground truth):
StorageSizeFieldEditor(String name,String labelText,Composite parent,int min,int max){
  Assert.isTrue(min > 0 && min < max);
  init(name,labelText);
  setTextLimit(10);
  setEmptyStringAllowed(false);
  setErrorMessage(JFaceResources.format("String_Node_Str",Integer.valueOf(min),Integer.valueOf(max)));
  createControl(parent);
  minValidValue=min;
  maxValidValue=max;
}
Program: 91403
Project: 91403
Buggy source:
private int parse(final String str){
  String n=str.trim();
  if (n.length() == 0)   return 0;
  int mul=1;
switch (Character.toLowerCase(n.charAt(n.length() - 1))) {
case 'g':
    mul=GB;
  break;
case 'm':
mul=MB;
break;
case 'k':
mul=KB;
break;
}
if (mul > 1) n=n.substring(0,n.length() - 1).trim();
if (n.length() == 0) return 0;
try {
return mul * Integer.parseInt(n);
}
 catch (NumberFormatException nfe) {
return 0;
}
}

Fixed version (ground truth):
private int parse(final String str){
  String n=str.trim();
  if (n.length() == 0)   return 0;
  int mul=1;
  char lastChar=n.charAt(n.length() - 1);
switch (Character.toLowerCase(lastChar)) {
case 'g':
    mul=GB;
  break;
case 'm':
mul=MB;
break;
case 'k':
mul=KB;
break;
default :
if (Character.isDigit(lastChar)) {
break;
}
return 0;
}
if (mul > 1) n=n.substring(0,n.length() - 1).trim();
if (n.length() == 0) return 0;
try {
return mul * Integer.parseInt(n);
}
 catch (NumberFormatException nfe) {
return 0;
}
}
Program: 91404
Project: 91404
Buggy source:
@Override public void resourceChanged(IResourceChangeEvent event){
  Set<IResource> resources=new HashSet<>();
  IMarkerDelta[] markerDeltas=event.findMarkerDeltas(IMarker.PROBLEM,true);
  for (  IMarkerDelta delta : markerDeltas)   resources.add(delta.getResource());
  if (!resources.isEmpty())   updateLabels(resources);
}

Fixed version (ground truth):
@Override public void resourceChanged(IResourceChangeEvent event){
  Set<IResource> resources=new HashSet<>();
  IMarkerDelta[] markerDeltas=event.findMarkerDeltas(IMarker.PROBLEM,true);
  for (  IMarkerDelta delta : markerDeltas) {
    IResource resource=delta.getResource();
    while (resource.getType() != IResource.ROOT && resources.add(resource)) {
      resource=resource.getParent();
    }
  }
  if (!resources.isEmpty()) {
    updateLabels(resources);
  }
}
Program: 91405
Project: 91405
Buggy source:
private void updateLabels(Set<IResource> changedResources){
  List<Object> elements=getAffectedElements(changedResources);
  if (!elements.isEmpty()) {
    final Object[] updateElements=elements.toArray(new Object[elements.size()]);
    Display display=viewer.getControl().getDisplay();
    display.asyncExec(new Runnable(){
      @Override public void run(){
        viewer.update(updateElements,null);
      }
    }
);
  }
}

Fixed version (ground truth):
private void updateLabels(Set<IResource> changedResources){
  List<Object> elements=getAffectedElements(changedResources);
  if (!elements.isEmpty()) {
    final Object[] updateElements=elements.toArray(new Object[elements.size()]);
    Display display=viewer.getControl().getDisplay();
    display.asyncExec(new Runnable(){
      @Override public void run(){
        fireLabelProviderChanged(new LabelProviderChangedEvent(ProblemLabelDecorator.this,updateElements));
      }
    }
);
  }
}
Program: 91406
Project: 91406
Buggy source:
@Override public void dispose(){
  resourceManager.dispose();
  if (this.viewer != null)   ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
  super.dispose();
}

Fixed version (ground truth):
@Override public void dispose(){
  super.dispose();
  resourceManager.dispose();
  if (this.viewer != null)   ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
}
Program: 91407
Project: 91407
Buggy source:
@Override public void run(){
  viewer.update(updateElements,null);
}

Fixed version (ground truth):
@Override public void run(){
  fireLabelProviderChanged(new LabelProviderChangedEvent(ProblemLabelDecorator.this,updateElements));
}
Program: 91408
Project: 91408
Buggy source:
private List<Object> getAffectedElements(Set<IResource> resources){
  List<Object> result=new ArrayList<>();
  if (viewer.getContentProvider() instanceof IStructuredContentProvider) {
    IStructuredContentProvider contentProvider=(IStructuredContentProvider)viewer.getContentProvider();
    Object[] elements=contentProvider.getElements(null);
    for (    Object element : elements) {
      IResource resource=AdapterUtils.adapt(element,IResource.class);
      if (resource != null && resources.contains(resource))       result.add(element);
    }
  }
  return result;
}

Fixed version (ground truth):
private void getAffectedElements(Set<IResource> resources,Object[] elements,IStructuredContentProvider contentProvider,List<Object> result){
  for (  Object element : elements) {
    IResource resource=AdapterUtils.adapt(element,IResource.class);
    if (resource != null && resources.contains(resource)) {
      result.add(element);
      if (contentProvider instanceof ITreeContentProvider) {
        getAffectedElements(resources,((ITreeContentProvider)contentProvider).getChildren(element),contentProvider,result);
      }
    }
  }
}
Program: 91409
Project: 91409
Buggy source:
@Override public int getProblemSeverity(){
  if (container == null)   return SEVERITY_NONE;
  try {
    return container.findMaxProblemSeverity(IMarker.PROBLEM,true,IResource.DEPTH_ONE);
  }
 catch (  CoreException e) {
    return SEVERITY_NONE;
  }
}

Fixed version (ground truth):
@Override public int getProblemSeverity(){
  if (container == null)   return SEVERITY_NONE;
  try {
    return container.findMaxProblemSeverity(IMarker.PROBLEM,true,IResource.DEPTH_INFINITE);
  }
 catch (  CoreException e) {
    return SEVERITY_NONE;
  }
}
Program: 91411
Project: 91411
Buggy source:
@Override public void resourceChanged(IResourceChangeEvent event){
  Set<IResource> resources=new HashSet<>();
  IMarkerDelta[] markerDeltas=event.findMarkerDeltas(IMarker.PROBLEM,true);
  for (  IMarkerDelta delta : markerDeltas)   resources.add(delta.getResource());
  if (!resources.isEmpty())   updateLabels(resources);
}

Fixed version (ground truth):
@Override public void resourceChanged(IResourceChangeEvent event){
  Set<IResource> resources=new HashSet<>();
  IMarkerDelta[] markerDeltas=event.findMarkerDeltas(IMarker.PROBLEM,true);
  for (  IMarkerDelta delta : markerDeltas) {
    IResource resource=delta.getResource();
    while (resource.getType() != IResource.ROOT && resources.add(resource)) {
      resource=resource.getParent();
    }
  }
  if (!resources.isEmpty()) {
    updateLabels(resources);
  }
}
Program: 91412
Project: 91412
Buggy source:
private void updateLabels(Set<IResource> changedResources){
  List<Object> elements=getAffectedElements(changedResources);
  if (!elements.isEmpty()) {
    final Object[] updateElements=elements.toArray(new Object[elements.size()]);
    Display display=viewer.getControl().getDisplay();
    display.asyncExec(new Runnable(){
      @Override public void run(){
        viewer.update(updateElements,null);
      }
    }
);
  }
}

Fixed version (ground truth):
private void updateLabels(Set<IResource> changedResources){
  List<Object> elements=getAffectedElements(changedResources);
  if (!elements.isEmpty()) {
    final Object[] updateElements=elements.toArray(new Object[elements.size()]);
    Display display=viewer.getControl().getDisplay();
    display.asyncExec(new Runnable(){
      @Override public void run(){
        fireLabelProviderChanged(new LabelProviderChangedEvent(ProblemLabelDecorator.this,updateElements));
      }
    }
);
  }
}
Program: 91413
Project: 91413
Buggy source:
@Override public void dispose(){
  resourceManager.dispose();
  if (this.viewer != null)   ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
  super.dispose();
}

Fixed version (ground truth):
@Override public void dispose(){
  super.dispose();
  resourceManager.dispose();
  if (this.viewer != null)   ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
}
Program: 91414
Project: 91414
Buggy source:
@Override public void run(){
  viewer.update(updateElements,null);
}

Fixed version (ground truth):
@Override public void run(){
  fireLabelProviderChanged(new LabelProviderChangedEvent(ProblemLabelDecorator.this,updateElements));
}
Program: 91415
Project: 91415
Buggy source:
private List<Object> getAffectedElements(Set<IResource> resources){
  List<Object> result=new ArrayList<>();
  if (viewer.getContentProvider() instanceof IStructuredContentProvider) {
    IStructuredContentProvider contentProvider=(IStructuredContentProvider)viewer.getContentProvider();
    Object[] elements=contentProvider.getElements(null);
    for (    Object element : elements) {
      IResource resource=AdapterUtils.adapt(element,IResource.class);
      if (resource != null && resources.contains(resource))       result.add(element);
    }
  }
  return result;
}

Fixed version (ground truth):
private void getAffectedElements(Set<IResource> resources,Object[] elements,IStructuredContentProvider contentProvider,List<Object> result){
  for (  Object element : elements) {
    IResource resource=AdapterUtils.adapt(element,IResource.class);
    if (resource != null && resources.contains(resource)) {
      result.add(element);
      if (contentProvider instanceof ITreeContentProvider) {
        getAffectedElements(resources,((ITreeContentProvider)contentProvider).getChildren(element),contentProvider,result);
      }
    }
  }
}
Program: 91416
Project: 91416
Buggy source:
@Override public int getProblemSeverity(){
  if (container == null)   return SEVERITY_NONE;
  try {
    return container.findMaxProblemSeverity(IMarker.PROBLEM,true,IResource.DEPTH_ONE);
  }
 catch (  CoreException e) {
    return SEVERITY_NONE;
  }
}

Fixed version (ground truth):
@Override public int getProblemSeverity(){
  if (container == null)   return SEVERITY_NONE;
  try {
    return container.findMaxProblemSeverity(IMarker.PROBLEM,true,IResource.DEPTH_INFINITE);
  }
 catch (  CoreException e) {
    return SEVERITY_NONE;
  }
}
Program: 91418
Project: 91418
Buggy source:
private RepositoryMapping(final @NonNull IContainer mappedContainer,final @NonNull IPath location,final @NonNull File gitDir){
  container=mappedContainer;
  containerPathString=container.getProjectRelativePath().toPortableString();
  if (!gitDir.isAbsolute()) {
    gitDirPathString=Path.fromOSString(gitDir.getPath()).removeTrailingSeparator().toPortableString();
    return;
  }
  java.nio.file.Path gPath=gitDir.toPath();
  java.nio.file.Path lPath=location.toFile().toPath();
  if (lPath.getNameCount() > 0 && gPath.getNameCount() > 0 && gPath.getRoot().equals(lPath.getRoot()) && gPath.getName(0).equals(lPath.getName(0))) {
    gPath=lPath.relativize(gPath);
  }
  gitDirPathString=Path.fromOSString(gPath.toString()).removeTrailingSeparator().toPortableString();
}

Fixed version (ground truth):
private RepositoryMapping(final @NonNull IContainer mappedContainer,final @NonNull IPath location,final @NonNull File gitDir){
  container=mappedContainer;
  containerPathString=container.getProjectRelativePath().toPortableString();
  if (!gitDir.isAbsolute()) {
    gitDirPathString=Path.fromOSString(gitDir.getPath()).removeTrailingSeparator().toPortableString();
    return;
  }
  java.nio.file.Path gPath=gitDir.toPath();
  java.nio.file.Path lPath=location.toFile().toPath();
  if (lPath.getNameCount() > 0 && gPath.getNameCount() > 0 && (gPath.getRoot() == lPath.getRoot() || gPath.getRoot() != null && gPath.getRoot().equals(lPath.getRoot())) && gPath.getName(0).equals(lPath.getName(0))) {
    gPath=lPath.relativize(gPath);
  }
  gitDirPathString=Path.fromOSString(gPath.toString()).removeTrailingSeparator().toPortableString();
}
Program: 91419
Project: 91419
Buggy source:
private ISaveablesLifecycleListener getSaveablesLifecycleListener(IWorkbenchPart part){
  ISaveablesLifecycleListener listener=(ISaveablesLifecycleListener)Utils.getAdapter(part,ISaveablesLifecycleListener.class);
  if (listener == null)   listener=CommonUtils.getService(part.getSite(),ISaveablesLifecycleListener.class);
  return listener;
}

Fixed version (ground truth):
private ISaveablesLifecycleListener getSaveablesLifecycleListener(IWorkbenchPart part){
  ISaveablesLifecycleListener listener=AdapterUtils.adapt(part,ISaveablesLifecycleListener.class);
  if (listener == null)   listener=CommonUtils.getService(part.getSite(),ISaveablesLifecycleListener.class);
  return listener;
}
Program: 91420
Project: 91420
Buggy source:
@Nullable @Override public String asReference(URI uri,String projectName){
  try {
    GitURI gitURI=new GitURI(uri);
    return asReference(gitURI.getRepository().toString(),gitURI.getTag(),gitURI.getPath().toString());
  }
 catch (  IllegalArgumentException e) {
    Activator.error(e.getMessage(),e);
    return null;
  }
}

Fixed version (ground truth):
@Nullable @Override public String asReference(URI uri,String projectName){
  try {
    GitURI gitURI=new GitURI(uri);
    return asReference(gitURI.getRepository().toString(),gitURI.getTag(),gitURI.getPath().toString());
  }
 catch (  IllegalArgumentException e) {
    Activator.logError(e.getMessage(),e);
    return null;
  }
}
Program: 91421
Project: 91421
Buggy source:
/** 
 * Refreshes all resources that changed in the index since the last call to this method. This is suitable for incremental updates on index changed events For bare repositories this does nothing.
 */
private void refreshIndexDelta(){
  Repository repository=getRepository();
  if (repository == null || repository.isBare()) {
    return;
  }
  try {
    DirCache currentIndex=DirCache.read(repository.getIndexFile(),repository.getFS());
    DirCache oldIndex=lastIndex;
    lastIndex=currentIndex;
    if (oldIndex == null) {
      refresh();
      return;
    }
    Set<String> paths=new TreeSet<String>();
    try (TreeWalk walk=new TreeWalk(repository)){
      walk.addTree(new DirCacheIterator(oldIndex));
      walk.addTree(new DirCacheIterator(currentIndex));
      walk.setFilter(new InterIndexDiffFilter());
      while (walk.next()) {
        if (walk.isSubtree())         walk.enterSubtree();
 else         paths.add(walk.getPathString());
      }
    }
     if (!paths.isEmpty())     refreshFiles(paths);
  }
 catch (  IOException ex) {
    Activator.error(MessageFormat.format(CoreText.IndexDiffCacheEntry_errorCalculatingIndexDelta,repository),ex);
    scheduleReloadJob("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Refreshes all resources that changed in the index since the last call to this method. This is suitable for incremental updates on index changed events For bare repositories this does nothing.
 */
private void refreshIndexDelta(){
  Repository repository=getRepository();
  if (repository == null || repository.isBare()) {
    return;
  }
  try {
    DirCache currentIndex=DirCache.read(repository.getIndexFile(),repository.getFS());
    DirCache oldIndex=lastIndex;
    lastIndex=currentIndex;
    if (oldIndex == null) {
      refresh();
      return;
    }
    Set<String> paths=new TreeSet<String>();
    try (TreeWalk walk=new TreeWalk(repository)){
      walk.addTree(new DirCacheIterator(oldIndex));
      walk.addTree(new DirCacheIterator(currentIndex));
      walk.setFilter(new InterIndexDiffFilter());
      while (walk.next()) {
        if (walk.isSubtree())         walk.enterSubtree();
 else         paths.add(walk.getPathString());
      }
    }
     if (!paths.isEmpty())     refreshFiles(paths);
  }
 catch (  IOException ex) {
    Activator.logError(MessageFormat.format(CoreText.IndexDiffCacheEntry_errorCalculatingIndexDelta,repository),ex);
    scheduleReloadJob("String_Node_Str");
  }
}
Program: 91423
Project: 91423
Buggy source:
/** 
 * Touches all descendants named ".git" so that they'll be included in a subsequent resource delta.
 * @param project to process
 * @param monitor for progress reporting and cancellation, may be  {@code null}if neither is desired
 */
private void touchGitResources(IProject project,IProgressMonitor monitor){
  final SubMonitor progress=SubMonitor.convert(monitor,1);
  try {
    project.accept(new IResourceProxyVisitor(){
      @Override public boolean visit(      IResourceProxy resource) throws CoreException {
        int type=resource.getType();
        if ((type == IResource.FILE || type == IResource.FOLDER) && Constants.DOT_GIT.equals(resource.getName())) {
          progress.setWorkRemaining(2);
          resource.requestResource().touch(progress.newChild(1));
          return false;
        }
        return true;
      }
    }
,IResource.NONE);
  }
 catch (  CoreException e) {
    Activator.error(e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Touches all descendants named ".git" so that they'll be included in a subsequent resource delta.
 * @param project to process
 * @param monitor for progress reporting and cancellation, may be  {@code null}if neither is desired
 */
private void touchGitResources(IProject project,IProgressMonitor monitor){
  final SubMonitor progress=SubMonitor.convert(monitor,1);
  try {
    project.accept(new IResourceProxyVisitor(){
      @Override public boolean visit(      IResourceProxy resource) throws CoreException {
        int type=resource.getType();
        if ((type == IResource.FILE || type == IResource.FOLDER) && Constants.DOT_GIT.equals(resource.getName())) {
          progress.setWorkRemaining(2);
          resource.requestResource().touch(progress.newChild(1));
          return false;
        }
        return true;
      }
    }
,IResource.NONE);
  }
 catch (  CoreException e) {
    Activator.logError(e.getMessage(),e);
  }
}
Program: 91424
Project: 91424
Buggy source:
@Override protected void fetchContents(IProgressMonitor monitor) throws TeamException {
  CommitBlobStorage content=new CommitBlobStorage(repo,getPath(),getObjectId(),getCommitId());
  try {
    setContents(content.getContents(),monitor);
  }
 catch (  CoreException e) {
    Activator.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override protected void fetchContents(IProgressMonitor monitor) throws TeamException {
  CommitBlobStorage content=new CommitBlobStorage(repo,getPath(),getObjectId(),getCommitId());
  try {
    setContents(content.getContents(),monitor);
  }
 catch (  CoreException e) {
    Activator.logError("String_Node_Str",e);
  }
}
Program: 91425
Project: 91425
Buggy source:
/** 
 * @param repo repository which should be scanned
 * @return list of changes in git staging area
 */
public static Map<String,Change> build(Repository repo){
  try (TreeWalk tw=new TreeWalk(repo)){
    tw.addTree(new DirCacheIterator(repo.readDirCache()));
    ObjectId headId=repo.resolve(HEAD);
    RevCommit headCommit=null;
    if (headId != null) {
      try (RevWalk rw=new RevWalk(repo)){
        headCommit=rw.parseCommit(headId);
      }
     }
    AbbreviatedObjectId commitId;
    if (headCommit != null) {
      tw.addTree(headCommit.getTree());
      commitId=AbbreviatedObjectId.fromObjectId(headCommit);
    }
 else {
      tw.addTree(new EmptyTreeIterator());
      commitId=AbbreviatedObjectId.fromObjectId(zeroId());
    }
    tw.setRecursive(true);
    headCommit=null;
    MutableObjectId idBuf=new MutableObjectId();
    Map<String,Change> result=new HashMap<String,Change>();
    while (tw.next()) {
      if (!shouldIncludeEntry(tw))       continue;
      Change change=new Change();
      change.name=tw.getNameString();
      change.remoteCommitId=commitId;
      tw.getObjectId(idBuf,0);
      change.objectId=AbbreviatedObjectId.fromObjectId(idBuf);
      tw.getObjectId(idBuf,1);
      change.remoteObjectId=AbbreviatedObjectId.fromObjectId(idBuf);
      calculateAndSetChangeKind(RIGHT,change);
      result.put(tw.getPathString(),change);
    }
    return result;
  }
 catch (  IOException e) {
    Activator.error(e.getMessage(),e);
    return new HashMap<String,Change>(0);
  }
}

Fixed version (ground truth):
/** 
 * @param repo repository which should be scanned
 * @return list of changes in git staging area
 */
public static Map<String,Change> build(Repository repo){
  try (TreeWalk tw=new TreeWalk(repo)){
    tw.addTree(new DirCacheIterator(repo.readDirCache()));
    ObjectId headId=repo.resolve(HEAD);
    RevCommit headCommit=null;
    if (headId != null) {
      try (RevWalk rw=new RevWalk(repo)){
        headCommit=rw.parseCommit(headId);
      }
     }
    AbbreviatedObjectId commitId;
    if (headCommit != null) {
      tw.addTree(headCommit.getTree());
      commitId=AbbreviatedObjectId.fromObjectId(headCommit);
    }
 else {
      tw.addTree(new EmptyTreeIterator());
      commitId=AbbreviatedObjectId.fromObjectId(zeroId());
    }
    tw.setRecursive(true);
    headCommit=null;
    MutableObjectId idBuf=new MutableObjectId();
    Map<String,Change> result=new HashMap<String,Change>();
    while (tw.next()) {
      if (!shouldIncludeEntry(tw))       continue;
      Change change=new Change();
      change.name=tw.getNameString();
      change.remoteCommitId=commitId;
      tw.getObjectId(idBuf,0);
      change.objectId=AbbreviatedObjectId.fromObjectId(idBuf);
      tw.getObjectId(idBuf,1);
      change.remoteObjectId=AbbreviatedObjectId.fromObjectId(idBuf);
      calculateAndSetChangeKind(RIGHT,change);
      result.put(tw.getPathString(),change);
    }
    return result;
  }
 catch (  IOException e) {
    Activator.logError(e.getMessage(),e);
    return new HashMap<String,Change>(0);
  }
}
Program: 91426
Project: 91426
Buggy source:
/** 
 * @param repo with should be scanned
 * @return list of changes in working tree
 */
public static Map<String,Change> build(Repository repo){
  try (TreeWalk tw=new TreeWalk(repo)){
    int fileNth=tw.addTree(new FileTreeIterator(repo));
    int cacheNth=tw.addTree(new DirCacheIterator(repo.readDirCache()));
    tw.setFilter(new IndexDiffFilter(cacheNth,fileNth));
    tw.setRecursive(true);
    Map<String,Change> result=new HashMap<String,Change>();
    MutableObjectId idBuf=new MutableObjectId();
    while (tw.next()) {
      Change change=new Change();
      change.name=tw.getNameString();
      tw.getObjectId(idBuf,0);
      change.objectId=AbbreviatedObjectId.fromObjectId(idBuf);
      tw.getObjectId(idBuf,1);
      change.remoteObjectId=AbbreviatedObjectId.fromObjectId(idBuf);
      calculateAndSetChangeKind(RIGHT,change);
      result.put(tw.getPathString(),change);
    }
    return result;
  }
 catch (  IOException e) {
    Activator.error(e.getMessage(),e);
    return new HashMap<String,GitCommitsModelCache.Change>(0);
  }
}

Fixed version (ground truth):
/** 
 * @param repo with should be scanned
 * @return list of changes in working tree
 */
public static Map<String,Change> build(Repository repo){
  try (TreeWalk tw=new TreeWalk(repo)){
    int fileNth=tw.addTree(new FileTreeIterator(repo));
    int cacheNth=tw.addTree(new DirCacheIterator(repo.readDirCache()));
    tw.setFilter(new IndexDiffFilter(cacheNth,fileNth));
    tw.setRecursive(true);
    Map<String,Change> result=new HashMap<String,Change>();
    MutableObjectId idBuf=new MutableObjectId();
    while (tw.next()) {
      Change change=new Change();
      change.name=tw.getNameString();
      tw.getObjectId(idBuf,0);
      change.objectId=AbbreviatedObjectId.fromObjectId(idBuf);
      tw.getObjectId(idBuf,1);
      change.remoteObjectId=AbbreviatedObjectId.fromObjectId(idBuf);
      calculateAndSetChangeKind(RIGHT,change);
      result.put(tw.getPathString(),change);
    }
    return result;
  }
 catch (  IOException e) {
    Activator.logError(e.getMessage(),e);
    return new HashMap<String,GitCommitsModelCache.Change>(0);
  }
}
Program: 91427
Project: 91427
Buggy source:
/** 
 * Get the status of whether the commit operation should be enabled or disabled. <p> This method checks the current state of the widgets and must always be called from the UI-thread. <p> The returned status includes a message and type denoting why committing cannot be completed.
 * @return non-null commit status
 */
public CommitStatus getStatus(){
  if (!commitAllowed)   return new CommitStatus(cannotCommitMessage,IMessageProvider.ERROR);
  String authorValue=authorText.getText();
  if (authorValue.length() == 0 || RawParseUtils.parsePersonIdent(authorValue) == null)   return new CommitStatus(UIText.CommitMessageComponent_MessageInvalidAuthor,IMessageProvider.ERROR);
  String committerValue=committerText.getText();
  if (committerValue.length() == 0 || RawParseUtils.parsePersonIdent(committerValue) == null) {
    return new CommitStatus(UIText.CommitMessageComponent_MessageInvalidCommitter,IMessageProvider.ERROR);
  }
  if (amending && amendingCommitInRemoteBranch)   return new CommitStatus(UIText.CommitMessageComponent_AmendingCommitInRemoteBranch,IMessageProvider.WARNING);
  if (org.eclipse.egit.ui.Activator.getDefault().getPreferenceStore().getBoolean(UIPreferences.COMMIT_DIALOG_WARN_ABOUT_MESSAGE_SECOND_LINE)) {
    String message=commitText.getCommitMessage();
    String formatIssue=formatIssuesInCommitMessage(message);
    if (formatIssue != null) {
      return new CommitStatus(formatIssue,IMessageProvider.WARNING);
    }
  }
  return CommitStatus.OK;
}

Fixed version (ground truth):
/** 
 * Get the status of whether the commit operation should be enabled or disabled. <p> This method checks the current state of the widgets and must always be called from the UI-thread. <p> The returned status includes a message and type denoting why committing cannot be completed.
 * @return non-null commit status
 */
public CommitStatus getStatus(){
  if (!commitAllowed)   return new CommitStatus(cannotCommitMessage,IMessageProvider.ERROR);
  String authorValue=authorText.getText();
  if (authorValue.length() == 0 || RawParseUtils.parsePersonIdent(authorValue) == null)   return new CommitStatus(UIText.CommitMessageComponent_MessageInvalidAuthor,IMessageProvider.ERROR);
  String committerValue=committerText.getText();
  if (committerValue.length() == 0 || RawParseUtils.parsePersonIdent(committerValue) == null) {
    return new CommitStatus(UIText.CommitMessageComponent_MessageInvalidCommitter,IMessageProvider.ERROR);
  }
  if (amending && amendingCommitInRemoteBranch)   return new CommitStatus(UIText.CommitMessageComponent_AmendingCommitInRemoteBranch,IMessageProvider.WARNING);
  if (Activator.getDefault().getPreferenceStore().getBoolean(UIPreferences.COMMIT_DIALOG_WARN_ABOUT_MESSAGE_SECOND_LINE)) {
    String message=commitText.getCommitMessage();
    String formatIssue=formatIssuesInCommitMessage(message);
    if (formatIssue != null) {
      return new CommitStatus(formatIssue,IMessageProvider.WARNING);
    }
  }
  return CommitStatus.OK;
}
Program: 91428
Project: 91428
Buggy source:
/** 
 * @param paths
 * @return the calculated commit message
 */
private String calculateCommitMessage(Collection<String> paths){
  if (commitMessage != null) {
    return commitMessage;
  }
  if (amending)   return previousCommitMessage;
  String calculatedCommitMessage=null;
  Set<IResource> resources=new HashSet<IResource>();
  for (  String path : paths) {
    IFile file=findFile(path);
    if (file != null)     resources.add(file.getProject());
  }
  try {
    ICommitMessageProvider messageProvider=getCommitMessageProvider();
    if (messageProvider != null) {
      IResource[] resourcesArray=resources.toArray(new IResource[0]);
      calculatedCommitMessage=messageProvider.getMessage(resourcesArray);
    }
  }
 catch (  CoreException coreException) {
    Activator.error(coreException.getLocalizedMessage(),coreException);
  }
  if (calculatedCommitMessage != null)   return calculatedCommitMessage;
 else   return EMPTY_STRING;
}

Fixed version (ground truth):
/** 
 * @param paths
 * @return the calculated commit message
 */
private String calculateCommitMessage(Collection<String> paths){
  if (commitMessage != null) {
    return commitMessage;
  }
  if (amending)   return previousCommitMessage;
  String calculatedCommitMessage=null;
  Set<IResource> resources=new HashSet<IResource>();
  for (  String path : paths) {
    IFile file=findFile(path);
    if (file != null)     resources.add(file.getProject());
  }
  try {
    ICommitMessageProvider messageProvider=getCommitMessageProvider();
    if (messageProvider != null) {
      IResource[] resourcesArray=resources.toArray(new IResource[0]);
      calculatedCommitMessage=messageProvider.getMessage(resourcesArray);
    }
  }
 catch (  CoreException coreException) {
    Activator.logError(coreException.getLocalizedMessage(),coreException);
  }
  if (calculatedCommitMessage != null)   return calculatedCommitMessage;
 else   return EMPTY_STRING;
}
Program: 91429
Project: 91429
Buggy source:
/** 
 * Sets the defaults for change id and signed off
 */
public void setDefaults(){
  if (repository != null)   createChangeId=GerritUtil.getCreateChangeId(repository.getConfig());
  signedOff=org.eclipse.egit.ui.Activator.getDefault().getPreferenceStore().getBoolean(UIPreferences.COMMIT_DIALOG_SIGNED_OFF_BY);
}

Fixed version (ground truth):
/** 
 * Sets the defaults for change id and signed off
 */
public void setDefaults(){
  if (repository != null)   createChangeId=GerritUtil.getCreateChangeId(repository.getConfig());
  signedOff=Activator.getDefault().getPreferenceStore().getBoolean(UIPreferences.COMMIT_DIALOG_SIGNED_OFF_BY);
}
Program: 91430
Project: 91430
Buggy source:
/** 
 * Tests that a   {@link RepositoryMapping} internally uses a relative path ifat all possible.
 */
@Test public void shouldResolveAsRelativePath(){
  IProject proj=project.getProject();
  IPath projectPath=proj.getLocation().removeTrailingSeparator();
  String gitHereTest="String_Node_Str";
  String gitTest="String_Node_Str";
  String gitSubdirTest="String_Node_Str";
  String gitSubmoduleTest="String_Node_Str";
  String gitAbsolute=projectPath.uptoSegment(0).append(projectPath.segment(0) + "String_Node_Str").append("String_Node_Str").toOSString();
  String parents="String_Node_Str";
  while (projectPath.segmentCount() > 2) {
    String pathString=projectPath.toOSString();
    assertRepoMappingPath(proj,pathString,gitHereTest,parents);
    assertRepoMappingPath(proj,pathString,gitTest,parents);
    assertRepoMappingPath(proj,pathString,gitSubdirTest,parents);
    assertRepoMappingPath(proj,pathString,gitSubmoduleTest,parents);
    assertRepoMappingPath(proj,pathString,gitAbsolute,"String_Node_Str");
    projectPath=projectPath.removeLastSegments(1);
    parents+="String_Node_Str";
  }
}

Fixed version (ground truth):
/** 
 * Tests that a   {@link RepositoryMapping} internally uses a relative path ifat all possible.
 */
@Test public void shouldResolveAsRelativePath(){
  IProject proj=project.getProject();
  IPath projectPath=proj.getLocation().removeTrailingSeparator();
  String gitHereTest="String_Node_Str";
  String gitTest="String_Node_Str";
  String gitSubdirTest="String_Node_Str";
  String gitSubmoduleTest="String_Node_Str";
  String gitAbsolute=projectPath.uptoSegment(0).append(projectPath.segment(0) + "String_Node_Str").append("String_Node_Str").toPortableString();
  String parents="String_Node_Str";
  while (projectPath.segmentCount() > 2) {
    String pathString=projectPath.toOSString();
    assertRepoMappingPath(proj,pathString,gitHereTest,parents);
    assertRepoMappingPath(proj,pathString,gitTest,parents);
    assertRepoMappingPath(proj,pathString,gitSubdirTest,parents);
    assertRepoMappingPath(proj,pathString,gitSubmoduleTest,parents);
    assertRepoMappingPath(proj,pathString,gitAbsolute,"String_Node_Str");
    projectPath=projectPath.removeLastSegments(1);
    parents+="String_Node_Str";
  }
}
Program: 91431
Project: 91431
Buggy source:
private void assertRepoMappingPath(IProject testProject,String path,String testDir,String parents){
  String testDirOS=testDir.replace('/',File.separatorChar);
  File testFile=new File(testDirOS);
  if (!testFile.isAbsolute()) {
    testFile=new File(new File(path),testDirOS);
  }
  RepositoryMapping mapping=RepositoryMapping.create(testProject,testFile);
  assertEquals(parents + testDir,mapping.getGitDirPath().toPortableString());
}

Fixed version (ground truth):
private void assertRepoMappingPath(IProject testProject,String pathOS,String testDirPortable,String parentsPortable){
  String testDirOS=testDirPortable.replace('/',File.separatorChar);
  File testFile=new File(testDirOS);
  if (!testFile.isAbsolute()) {
    testFile=new File(new File(pathOS),testDirOS);
  }
  RepositoryMapping mapping=RepositoryMapping.create(testProject,testFile);
  assertEquals(parentsPortable + testDirPortable,mapping.getGitDirPath().toPortableString());
}
Program: 91433
Project: 91433
Buggy source:
/** 
 * Checks if the existing resource with given path can be automatically added to the .gitignore file.
 * @param path Path to be checked, file or directory must exist on the disk
 * @return true if the file or directory at given path exists, is insideknown git repository and does not match any existing ignore rule, false otherwise
 * @throws IOException
 * @since 4.1.0
 */
public static boolean canBeAutoIgnored(IPath path) throws IOException {
  Repository repository=Activator.getDefault().getRepositoryCache().getRepository(path);
  if (repository == null || repository.isBare()) {
    return false;
  }
  WorkingTreeIterator treeIterator=IteratorService.createInitialIterator(repository);
  if (treeIterator == null) {
    return false;
  }
  String repoRelativePath=path.makeRelativeTo(new Path(repository.getWorkTree().getAbsolutePath())).toString();
  if (repoRelativePath.length() == 0 || repoRelativePath.equals(path)) {
    return false;
  }
  try (TreeWalk walk=new TreeWalk(repository)){
    walk.addTree(treeIterator);
    walk.setFilter(PathFilter.create(repoRelativePath));
    while (walk.next()) {
      WorkingTreeIterator workingTreeIterator=walk.getTree(0,WorkingTreeIterator.class);
      if (walk.getPathString().equals(repoRelativePath)) {
        return !workingTreeIterator.isEntryIgnored();
      }
      if (workingTreeIterator.getEntryFileMode().equals(FileMode.TREE)) {
        walk.enterSubtree();
      }
    }
  }
   return false;
}

Fixed version (ground truth):
/** 
 * Checks if the existing resource with given path can be automatically added to the .gitignore file.
 * @param path Path to be checked, file or directory must exist on the disk
 * @return true if the file or directory at given path exists, is insideknown git repository and does not match any existing ignore rule, false otherwise
 * @throws IOException
 * @since 4.1.0
 */
public static boolean canBeAutoIgnored(IPath path) throws IOException {
  Repository repository=Activator.getDefault().getRepositoryCache().getRepository(path);
  if (repository == null || repository.isBare()) {
    return false;
  }
  WorkingTreeIterator treeIterator=IteratorService.createInitialIterator(repository);
  if (treeIterator == null) {
    return false;
  }
  String repoRelativePath=path.makeRelativeTo(new Path(repository.getWorkTree().getAbsolutePath())).toString();
  if (repoRelativePath.length() == 0 || repoRelativePath.equals(path.toString())) {
    return false;
  }
  try (TreeWalk walk=new TreeWalk(repository)){
    walk.addTree(treeIterator);
    walk.setFilter(PathFilter.create(repoRelativePath));
    while (walk.next()) {
      WorkingTreeIterator workingTreeIterator=walk.getTree(0,WorkingTreeIterator.class);
      if (walk.getPathString().equals(repoRelativePath)) {
        return !workingTreeIterator.isEntryIgnored();
      }
      if (workingTreeIterator.getEntryFileMode().equals(FileMode.TREE)) {
        walk.enterSubtree();
      }
    }
  }
   return false;
}
Program: 91434
Project: 91434
Buggy source:
private boolean isStaged(Repository repository,IPath location,boolean checkIndex){
  if (location == null || location.toFile().isDirectory() || repository.isBare()) {
    return false;
  }
  IPath workDir=new Path(repository.getWorkTree().getAbsolutePath());
  String resRelPath=location.makeRelativeTo(workDir).toString();
  if (resRelPath.length() == 0 || resRelPath.equals(location)) {
    return false;
  }
  if (!checkIndex) {
    return true;
  }
  try {
    FileTreeIterator fileTreeIterator=new FileTreeIterator(repository);
    IndexDiff indexDiff=new IndexDiff(repository,Constants.HEAD,fileTreeIterator);
    indexDiff.setFilter(PathFilterGroup.createFromStrings(Collections.singletonList(resRelPath)));
    indexDiff.diff();
    return indexDiff.getAdded().contains(resRelPath) || indexDiff.getChanged().contains(resRelPath) || indexDiff.getRemoved().contains(resRelPath);
  }
 catch (  IOException e) {
    Activator.error(NLS.bind(UIText.GitHistoryPage_errorLookingUpPath,location.toString()),e);
    return false;
  }
}

Fixed version (ground truth):
private boolean isStaged(Repository repository,IPath location,boolean checkIndex){
  if (location == null || location.toFile().isDirectory() || repository.isBare()) {
    return false;
  }
  IPath workDir=new Path(repository.getWorkTree().getAbsolutePath());
  String resRelPath=location.makeRelativeTo(workDir).toString();
  if (resRelPath.length() == 0 || resRelPath.equals(location.toString())) {
    return false;
  }
  if (!checkIndex) {
    return true;
  }
  try {
    FileTreeIterator fileTreeIterator=new FileTreeIterator(repository);
    IndexDiff indexDiff=new IndexDiff(repository,Constants.HEAD,fileTreeIterator);
    indexDiff.setFilter(PathFilterGroup.createFromStrings(Collections.singletonList(resRelPath)));
    indexDiff.diff();
    return indexDiff.getAdded().contains(resRelPath) || indexDiff.getChanged().contains(resRelPath) || indexDiff.getRemoved().contains(resRelPath);
  }
 catch (  IOException e) {
    Activator.error(NLS.bind(UIText.GitHistoryPage_errorLookingUpPath,location.toString()),e);
    return false;
  }
}
Program: 91435
Project: 91435
Buggy source:
@Override public void execute(IProgressMonitor monitor) throws CoreException {
  String branchName=repository.getConfig().getReleaseBranchName(versionName);
  try {
    if (releaseExists()) {
      throw new CoreException(error(format(CoreText.ReleaseStartOperation_releaseNameAlreadyExists,versionName)));
    }
    if (!repository.isDevelop()) {
      throw new CoreException(error(NLS.bind(CoreText.ReleaseStartOperation_notOn,repository.getConfig().getDevelop())));
    }
  }
 catch (  IOException e) {
    throw new CoreException(error(e.getMessage(),e));
  }
  RevCommit commit=repository.findCommit(startCommitSha1);
  if (commit == null) {
    throw new IllegalStateException(NLS.bind(CoreText.ReleaseStartOperation_unableToFindCommit,commit));
  }
  start(monitor,branchName,commit);
}

Fixed version (ground truth):
@Override public void execute(IProgressMonitor monitor) throws CoreException {
  String branchName=repository.getConfig().getReleaseBranchName(versionName);
  try {
    if (releaseExists()) {
      throw new CoreException(error(format(CoreText.ReleaseStartOperation_releaseNameAlreadyExists,versionName)));
    }
    if (!repository.isDevelop()) {
      throw new CoreException(error(NLS.bind(CoreText.ReleaseStartOperation_notOn,repository.getConfig().getDevelop())));
    }
  }
 catch (  IOException e) {
    throw new CoreException(error(e.getMessage(),e));
  }
  RevCommit commit=repository.findCommit(startCommitSha1);
  if (commit == null) {
    throw new IllegalStateException(NLS.bind(CoreText.ReleaseStartOperation_unableToFindCommit,startCommitSha1));
  }
  start(monitor,branchName,commit);
}
Program: 91436
Project: 91436
Buggy source:
private String makeRepoRelative(Repository repository,IResource res){
  return stripWorkDir(repository.getWorkTree(),res.getLocation().toFile());
}

Fixed version (ground truth):
@Nullable private String makeRepoRelative(Repository repository,IResource res){
  if (repository.isBare()) {
    return null;
  }
  IPath location=res.getLocation();
  if (location == null) {
    return null;
  }
  return stripWorkDir(repository.getWorkTree(),location.toFile());
}