nus-yam/ex-repair huggingface dataset:
Program: 7807
Project: 7807
Buggy source:
public void run(){
  commit[0]=(RevCommit)table.widget.getSelection()[0].getData();
}

Fixed version (ground truth):
public void run(){
  TableItem tableItem=table.widget.getSelection()[0];
  ensureTableItemLoaded(tableItem);
  commit[0]=(RevCommit)tableItem.getData();
}
Program: 7808
Project: 7808
Buggy source:
@Test public void testAddTag() throws Exception {
  Repository repo=lookupRepository(repoFile);
  assertNull(repo.resolve(Constants.R_TAGS + "String_Node_Str"));
  final SWTBotTable table=getHistoryViewTable(PROJ1);
  table.getTableItem(0).select();
  final RevCommit[] commit=new RevCommit[1];
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      commit[0]=(RevCommit)table.widget.getSelection()[0].getData();
    }
  }
);
  ContextMenuHelper.clickContextMenu(table,UIText.GitHistoryPage_CreateTagMenuLabel);
  SWTBotShell dialog=bot.shell(UIText.CreateTagDialog_NewTag);
  dialog.bot().textWithLabel(UIText.CreateTagDialog_tagName).setText("String_Node_Str");
  dialog.bot().textWithLabel(UIText.CreateTagDialog_tagMessage).setText("String_Node_Str");
  dialog.bot().button(IDialogConstants.OK_LABEL).click();
  waitInUI();
  assertNotNull(repo.resolve(Constants.R_TAGS + "String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testAddTag() throws Exception {
  Repository repo=lookupRepository(repoFile);
  assertNull(repo.resolve(Constants.R_TAGS + "String_Node_Str"));
  final SWTBotTable table=getHistoryViewTable(PROJ1);
  table.getTableItem(0).select();
  final RevCommit[] commit=new RevCommit[1];
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      TableItem tableItem=table.widget.getSelection()[0];
      ensureTableItemLoaded(tableItem);
      commit[0]=(RevCommit)tableItem.getData();
    }
  }
);
  ContextMenuHelper.clickContextMenu(table,UIText.GitHistoryPage_CreateTagMenuLabel);
  SWTBotShell dialog=bot.shell(UIText.CreateTagDialog_NewTag);
  dialog.bot().textWithLabel(UIText.CreateTagDialog_tagName).setText("String_Node_Str");
  dialog.bot().textWithLabel(UIText.CreateTagDialog_tagMessage).setText("String_Node_Str");
  dialog.bot().button(IDialogConstants.OK_LABEL).click();
  waitInUI();
  assertNotNull(repo.resolve(Constants.R_TAGS + "String_Node_Str"));
}
Program: 7809
Project: 7809
Buggy source:
@Test public void testCheckOut() throws Exception {
  Repository repo=lookupRepository(repoFile);
  assertEquals(Constants.MASTER,repo.getBranch());
  final SWTBotTable table=getHistoryViewTable(PROJ1);
  table.getTableItem(1).select();
  final RevCommit[] commit=new RevCommit[1];
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      commit[0]=(RevCommit)table.widget.getSelection()[0].getData();
    }
  }
);
  ContextMenuHelper.clickContextMenu(table,UIText.GitHistoryPage_CheckoutMenuLabel);
  waitInUI();
  assertEquals(commit[0].getId().name(),repo.getBranch());
}

Fixed version (ground truth):
@Test public void testCheckOut() throws Exception {
  Repository repo=lookupRepository(repoFile);
  assertEquals(Constants.MASTER,repo.getBranch());
  final SWTBotTable table=getHistoryViewTable(PROJ1);
  table.getTableItem(1).select();
  final RevCommit[] commit=new RevCommit[1];
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      TableItem tableItem=table.widget.getSelection()[0];
      ensureTableItemLoaded(tableItem);
      commit[0]=(RevCommit)tableItem.getData();
    }
  }
);
  ContextMenuHelper.clickContextMenu(table,UIText.GitHistoryPage_CheckoutMenuLabel);
  waitInUI();
  assertEquals(commit[0].getId().name(),repo.getBranch());
}
Program: 7812
Project: 7812
Buggy source:
private List<IPath> getPathList() throws IOException {
  List<IPath> result=new ArrayList<IPath>();
  Set<String> children=getRepository().getRefDatabase().getRefs(getObject().toPortableString()).keySet();
  for (  String pathEntry : children) {
    result.add(getObject().append(new Path(pathEntry)));
  }
  return result;
}

Fixed version (ground truth):
private List<IPath> getPathList() throws IOException {
  List<IPath> result=new ArrayList<IPath>();
  Map<String,Ref> refsMap=getRepository().getRefDatabase().getRefs(getObject().toPortableString());
  for (  Map.Entry<String,Ref> entry : refsMap.entrySet()) {
    if (entry.getValue().isSymbolic())     continue;
    result.add(getObject().append(new Path(entry.getKey())));
  }
  return result;
}
Program: 7813
Project: 7813
Buggy source:
@Test @Ignore public void testPushToPushDestination() throws Exception {
  pushTo("String_Node_Str",true);
  pushTo("String_Node_Str",false);
}

Fixed version (ground truth):
@Test public void testPushToPushDestination() throws Exception {
  pushTo("String_Node_Str",true);
  pushTo("String_Node_Str",false);
}
Program: 7815
Project: 7815
Buggy source:
/** 
 * @return list of all selected URIs - either the one specified as customURI or all URIs from selected configuration. May be null in case of no valid selection.
 */
public List<URIish> getPushURIs(){
  if (isURISelected())   return Collections.singletonList(uri);
  if (isConfigSelected())   return config.getPushURIs();
  return null;
}

Fixed version (ground truth):
/** 
 * @return list of all push URIs - either the one specified as custom URI orall push URIs of the selected configuration; if not push URIs were specified, the first URI is returned
 */
public List<URIish> getPushURIs(){
  if (isURISelected())   return Collections.singletonList(uri);
  if (isConfigSelected()) {
    List<URIish> pushUris=new ArrayList<URIish>();
    pushUris.addAll(config.getPushURIs());
    if (pushUris.isEmpty())     pushUris.add(config.getURIs().get(0));
    return pushUris;
  }
  return null;
}
Program: 7816
Project: 7816
Buggy source:
/** 
 * @return the selected URI (if specified by user as valid custom URI) orfirst URI from selected configuration (if specified by user as May be null if there is no valid selection.
 */
public URIish getURI(){
  if (isConfigSelected())   return config.getURIs().get(0);
  return uri;
}

Fixed version (ground truth):
/** 
 * @return the selected URI, <code>null</code> if a configuration wasselected
 */
public URIish getURI(){
  if (isConfigSelected())   return null;
  return uri;
}
Program: 7817
Project: 7817
Buggy source:
private String getSourceString(){
  final RepositorySelection repoSelection=repoPage.getSelection();
  if (repoSelection.isConfigSelected())   return repoSelection.getConfigName();
  return repoSelection.getURI().toString();
}

Fixed version (ground truth):
private String getSourceString(){
  final RepositorySelection repoSelection=repoPage.getSelection();
  if (repoSelection.isConfigSelected())   return repoSelection.getConfigName();
  return repoSelection.getURI(false).toString();
}
Program: 7818
Project: 7818
Buggy source:
@Override public boolean performFinish(){
  if (repoPage.getSelection().isConfigSelected() && refSpecPage.isSaveRequested())   saveConfig();
  final Transport transport;
  final RepositorySelection repoSelection=repoPage.getSelection();
  try {
    if (repoSelection.isConfigSelected())     transport=Transport.open(localDb,repoSelection.getConfig());
 else     transport=Transport.open(localDb,repoSelection.getURI());
  }
 catch (  final NotSupportedException e) {
    ErrorDialog.openError(getShell(),UIText.FetchWizard_transportNotSupportedTitle,UIText.FetchWizard_transportNotSupportedMessage,new Status(IStatus.ERROR,org.eclipse.egit.ui.Activator.getPluginId(),e.getMessage(),e));
    return false;
  }
  transport.setTagOpt(refSpecPage.getTagOpt());
  final Job fetchJob=new FetchJob(transport,refSpecPage.getRefSpecs(),getSourceString());
  fetchJob.setUser(true);
  fetchJob.schedule();
  repoPage.saveUriInPrefs();
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (repoPage.getSelection().isConfigSelected() && refSpecPage.isSaveRequested())   saveConfig();
  final Transport transport;
  final RepositorySelection repoSelection=repoPage.getSelection();
  try {
    if (repoSelection.isConfigSelected())     transport=Transport.open(localDb,repoSelection.getConfig());
 else     transport=Transport.open(localDb,repoSelection.getURI(false));
  }
 catch (  final NotSupportedException e) {
    ErrorDialog.openError(getShell(),UIText.FetchWizard_transportNotSupportedTitle,UIText.FetchWizard_transportNotSupportedMessage,new Status(IStatus.ERROR,org.eclipse.egit.ui.Activator.getPluginId(),e.getMessage(),e));
    return false;
  }
  transport.setTagOpt(refSpecPage.getTagOpt());
  final Job fetchJob=new FetchJob(transport,refSpecPage.getRefSpecs(),getSourceString());
  fetchJob.setUser(true);
  fetchJob.schedule();
  repoPage.saveUriInPrefs();
  return true;
}
Program: 7820
Project: 7820
Buggy source:
private String getDestinationString(){
  final RepositorySelection repoSelection=repoPage.getSelection();
  final String destination;
  if (repoSelection.isConfigSelected())   destination=repoSelection.getConfigName();
 else   destination=repoSelection.getURI().toString();
  return destination;
}

Fixed version (ground truth):
private String getDestinationString(){
  final RepositorySelection repoSelection=repoPage.getSelection();
  final String destination;
  if (repoSelection.isConfigSelected())   destination=repoSelection.getConfigName();
 else   destination=repoSelection.getURI(true).toString();
  return destination;
}
Program: 7821
Project: 7821
Buggy source:
private PushOperation createPushOperation(){
  try {
    final PushOperationSpecification spec;
    final RemoteConfig config=repoPage.getSelection().getConfig();
    if (confirmPage.isConfirmed()) {
      final PushOperationResult confirmedResult=confirmPage.getConfirmedResult();
      spec=confirmedResult.deriveSpecification(confirmPage.isRequireUnchangedSelected());
    }
 else {
      final Collection<RefSpec> fetchSpecs;
      if (config != null)       fetchSpecs=config.getPushRefSpecs();
 else       fetchSpecs=null;
      final Collection<RemoteRefUpdate> updates=Transport.findRemoteRefUpdatesFor(localDb,refSpecPage.getRefSpecs(),fetchSpecs);
      if (updates.isEmpty()) {
        ErrorDialog.openError(getShell(),UIText.PushWizard_missingRefsTitle,null,new Status(IStatus.ERROR,Activator.getPluginId(),UIText.PushWizard_missingRefsMessage));
        return null;
      }
      spec=new PushOperationSpecification();
      for (      final URIish uri : repoPage.getSelection().getAllURIs())       spec.addURIRefUpdates(uri,ConfirmationPage.copyUpdates(updates));
    }
    return new PushOperation(localDb,spec,false,config);
  }
 catch (  final IOException e) {
    ErrorDialog.openError(getShell(),UIText.PushWizard_cantPrepareUpdatesTitle,UIText.PushWizard_cantPrepareUpdatesMessage,new Status(IStatus.ERROR,Activator.getPluginId(),e.getMessage(),e));
    return null;
  }
}

Fixed version (ground truth):
private PushOperation createPushOperation(){
  try {
    final PushOperationSpecification spec;
    final RemoteConfig config=repoPage.getSelection().getConfig();
    if (confirmPage.isConfirmed()) {
      final PushOperationResult confirmedResult=confirmPage.getConfirmedResult();
      spec=confirmedResult.deriveSpecification(confirmPage.isRequireUnchangedSelected());
    }
 else {
      final Collection<RefSpec> fetchSpecs;
      if (config != null)       fetchSpecs=config.getPushRefSpecs();
 else       fetchSpecs=null;
      final Collection<RemoteRefUpdate> updates=Transport.findRemoteRefUpdatesFor(localDb,refSpecPage.getRefSpecs(),fetchSpecs);
      if (updates.isEmpty()) {
        ErrorDialog.openError(getShell(),UIText.PushWizard_missingRefsTitle,null,new Status(IStatus.ERROR,Activator.getPluginId(),UIText.PushWizard_missingRefsMessage));
        return null;
      }
      spec=new PushOperationSpecification();
      for (      final URIish uri : repoPage.getSelection().getPushURIs())       spec.addURIRefUpdates(uri,ConfirmationPage.copyUpdates(updates));
    }
    return new PushOperation(localDb,spec,false,config);
  }
 catch (  final IOException e) {
    ErrorDialog.openError(getShell(),UIText.PushWizard_cantPrepareUpdatesTitle,UIText.PushWizard_cantPrepareUpdatesMessage,new Status(IStatus.ERROR,Activator.getPluginId(),e.getMessage(),e));
    return null;
  }
}
Program: 7822
Project: 7822
Buggy source:
public void run(){
  try {
    MessageDialog.openInformation(getActiveShell(event),UIText.MergeAction_MergeResultTitle,op.getResult().toString());
  }
 catch (  ExecutionException e) {
    Activator.handleError(op.getResult().toString(),null,true);
  }
}

Fixed version (ground truth):
public void run(){
  Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
  MessageDialog.openInformation(shell,UIText.MergeAction_MergeResultTitle,op.getResult().toString());
}
Program: 7824
Project: 7824
Buggy source:
@Override public void done(IJobChangeEvent jobEvent){
  IStatus result=jobEvent.getJob().getResult();
  if (result.getSeverity() == IStatus.CANCEL) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        try {
          MessageDialog.openInformation(getActiveShell(event),UIText.MergeAction_MergeCanceledTitle,UIText.MergeAction_MergeCanceledMessage);
        }
 catch (        ExecutionException e) {
          Activator.handleError(UIText.MergeAction_MergeCanceledMessage,null,true);
        }
      }
    }
);
  }
 else   if (!result.isOK()) {
    Activator.handleError(result.getMessage(),result.getException(),true);
  }
 else {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        try {
          MessageDialog.openInformation(getActiveShell(event),UIText.MergeAction_MergeResultTitle,op.getResult().toString());
        }
 catch (        ExecutionException e) {
          Activator.handleError(op.getResult().toString(),null,true);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void done(IJobChangeEvent jobEvent){
  IStatus result=jobEvent.getJob().getResult();
  if (result.getSeverity() == IStatus.CANCEL) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        MessageDialog.openInformation(shell,UIText.MergeAction_MergeCanceledTitle,UIText.MergeAction_MergeCanceledMessage);
      }
    }
);
  }
 else   if (!result.isOK()) {
    Activator.handleError(result.getMessage(),result.getException(),true);
  }
 else {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        MessageDialog.openInformation(shell,UIText.MergeAction_MergeResultTitle,op.getResult().toString());
      }
    }
);
  }
}
Program: 7825
Project: 7825
Buggy source:
@Test @Ignore public void testPushToPushDestination() throws Exception {
  pushTo("String_Node_Str",true);
  pushTo("String_Node_Str",false);
}

Fixed version (ground truth):
@Test public void testPushToPushDestination() throws Exception {
  pushTo("String_Node_Str",true);
  pushTo("String_Node_Str",false);
}
Program: 7827
Project: 7827
Buggy source:
/** 
 * @return list of all selected URIs - either the one specified as customURI or all URIs from selected configuration. May be null in case of no valid selection.
 */
public List<URIish> getPushURIs(){
  if (isURISelected())   return Collections.singletonList(uri);
  if (isConfigSelected())   return config.getPushURIs();
  return null;
}

Fixed version (ground truth):
/** 
 * @return list of all push URIs - either the one specified as custom URI orall push URIs of the selected configuration; if not push URIs were specified, the first URI is returned
 */
public List<URIish> getPushURIs(){
  if (isURISelected())   return Collections.singletonList(uri);
  if (isConfigSelected()) {
    List<URIish> pushUris=new ArrayList<URIish>();
    pushUris.addAll(config.getPushURIs());
    if (pushUris.isEmpty())     pushUris.add(config.getURIs().get(0));
    return pushUris;
  }
  return null;
}
Program: 7828
Project: 7828
Buggy source:
/** 
 * @return the selected URI (if specified by user as valid custom URI) orfirst URI from selected configuration (if specified by user as May be null if there is no valid selection.
 */
public URIish getURI(){
  if (isConfigSelected())   return config.getURIs().get(0);
  return uri;
}

Fixed version (ground truth):
/** 
 * @return the selected URI, <code>null</code> if a configuration wasselected
 */
public URIish getURI(){
  if (isConfigSelected())   return null;
  return uri;
}
Program: 7829
Project: 7829
Buggy source:
private String getSourceString(){
  final RepositorySelection repoSelection=repoPage.getSelection();
  if (repoSelection.isConfigSelected())   return repoSelection.getConfigName();
  return repoSelection.getURI().toString();
}

Fixed version (ground truth):
private String getSourceString(){
  final RepositorySelection repoSelection=repoPage.getSelection();
  if (repoSelection.isConfigSelected())   return repoSelection.getConfigName();
  return repoSelection.getURI(false).toString();
}
Program: 7830
Project: 7830
Buggy source:
@Override public boolean performFinish(){
  if (repoPage.getSelection().isConfigSelected() && refSpecPage.isSaveRequested())   saveConfig();
  final Transport transport;
  final RepositorySelection repoSelection=repoPage.getSelection();
  try {
    if (repoSelection.isConfigSelected())     transport=Transport.open(localDb,repoSelection.getConfig());
 else     transport=Transport.open(localDb,repoSelection.getURI());
  }
 catch (  final NotSupportedException e) {
    ErrorDialog.openError(getShell(),UIText.FetchWizard_transportNotSupportedTitle,UIText.FetchWizard_transportNotSupportedMessage,new Status(IStatus.ERROR,org.eclipse.egit.ui.Activator.getPluginId(),e.getMessage(),e));
    return false;
  }
  transport.setTagOpt(refSpecPage.getTagOpt());
  final Job fetchJob=new FetchJob(transport,refSpecPage.getRefSpecs(),getSourceString());
  fetchJob.setUser(true);
  fetchJob.schedule();
  repoPage.saveUriInPrefs();
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (repoPage.getSelection().isConfigSelected() && refSpecPage.isSaveRequested())   saveConfig();
  final Transport transport;
  final RepositorySelection repoSelection=repoPage.getSelection();
  try {
    if (repoSelection.isConfigSelected())     transport=Transport.open(localDb,repoSelection.getConfig());
 else     transport=Transport.open(localDb,repoSelection.getURI(false));
  }
 catch (  final NotSupportedException e) {
    ErrorDialog.openError(getShell(),UIText.FetchWizard_transportNotSupportedTitle,UIText.FetchWizard_transportNotSupportedMessage,new Status(IStatus.ERROR,org.eclipse.egit.ui.Activator.getPluginId(),e.getMessage(),e));
    return false;
  }
  transport.setTagOpt(refSpecPage.getTagOpt());
  final Job fetchJob=new FetchJob(transport,refSpecPage.getRefSpecs(),getSourceString());
  fetchJob.setUser(true);
  fetchJob.schedule();
  repoPage.saveUriInPrefs();
  return true;
}
Program: 7832
Project: 7832
Buggy source:
private String getDestinationString(){
  final RepositorySelection repoSelection=repoPage.getSelection();
  final String destination;
  if (repoSelection.isConfigSelected())   destination=repoSelection.getConfigName();
 else   destination=repoSelection.getURI().toString();
  return destination;
}

Fixed version (ground truth):
private String getDestinationString(){
  final RepositorySelection repoSelection=repoPage.getSelection();
  final String destination;
  if (repoSelection.isConfigSelected())   destination=repoSelection.getConfigName();
 else   destination=repoSelection.getURI(true).toString();
  return destination;
}
Program: 7833
Project: 7833
Buggy source:
private PushOperation createPushOperation(){
  try {
    final PushOperationSpecification spec;
    final RemoteConfig config=repoPage.getSelection().getConfig();
    if (confirmPage.isConfirmed()) {
      final PushOperationResult confirmedResult=confirmPage.getConfirmedResult();
      spec=confirmedResult.deriveSpecification(confirmPage.isRequireUnchangedSelected());
    }
 else {
      final Collection<RefSpec> fetchSpecs;
      if (config != null)       fetchSpecs=config.getPushRefSpecs();
 else       fetchSpecs=null;
      final Collection<RemoteRefUpdate> updates=Transport.findRemoteRefUpdatesFor(localDb,refSpecPage.getRefSpecs(),fetchSpecs);
      if (updates.isEmpty()) {
        ErrorDialog.openError(getShell(),UIText.PushWizard_missingRefsTitle,null,new Status(IStatus.ERROR,Activator.getPluginId(),UIText.PushWizard_missingRefsMessage));
        return null;
      }
      spec=new PushOperationSpecification();
      for (      final URIish uri : repoPage.getSelection().getAllURIs())       spec.addURIRefUpdates(uri,ConfirmationPage.copyUpdates(updates));
    }
    return new PushOperation(localDb,spec,false,config);
  }
 catch (  final IOException e) {
    ErrorDialog.openError(getShell(),UIText.PushWizard_cantPrepareUpdatesTitle,UIText.PushWizard_cantPrepareUpdatesMessage,new Status(IStatus.ERROR,Activator.getPluginId(),e.getMessage(),e));
    return null;
  }
}

Fixed version (ground truth):
private PushOperation createPushOperation(){
  try {
    final PushOperationSpecification spec;
    final RemoteConfig config=repoPage.getSelection().getConfig();
    if (confirmPage.isConfirmed()) {
      final PushOperationResult confirmedResult=confirmPage.getConfirmedResult();
      spec=confirmedResult.deriveSpecification(confirmPage.isRequireUnchangedSelected());
    }
 else {
      final Collection<RefSpec> fetchSpecs;
      if (config != null)       fetchSpecs=config.getPushRefSpecs();
 else       fetchSpecs=null;
      final Collection<RemoteRefUpdate> updates=Transport.findRemoteRefUpdatesFor(localDb,refSpecPage.getRefSpecs(),fetchSpecs);
      if (updates.isEmpty()) {
        ErrorDialog.openError(getShell(),UIText.PushWizard_missingRefsTitle,null,new Status(IStatus.ERROR,Activator.getPluginId(),UIText.PushWizard_missingRefsMessage));
        return null;
      }
      spec=new PushOperationSpecification();
      for (      final URIish uri : repoPage.getSelection().getPushURIs())       spec.addURIRefUpdates(uri,ConfirmationPage.copyUpdates(updates));
    }
    return new PushOperation(localDb,spec,false,config);
  }
 catch (  final IOException e) {
    ErrorDialog.openError(getShell(),UIText.PushWizard_cantPrepareUpdatesTitle,UIText.PushWizard_cantPrepareUpdatesMessage,new Status(IStatus.ERROR,Activator.getPluginId(),e.getMessage(),e));
    return null;
  }
}
Program: 7834
Project: 7834
Buggy source:
public void run(){
  try {
    MessageDialog.openInformation(getShell(event),UIText.MergeAction_MergeResultTitle,op.getResult().toString());
  }
 catch (  ExecutionException e) {
    Activator.handleError(op.getResult().toString(),null,true);
  }
}

Fixed version (ground truth):
public void run(){
  Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
  MessageDialog.openInformation(shell,UIText.MergeAction_MergeResultTitle,op.getResult().toString());
}
Program: 7836
Project: 7836
Buggy source:
@Override public void done(IJobChangeEvent cevent){
  IStatus result=cevent.getJob().getResult();
  if (result.getSeverity() == IStatus.CANCEL) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        try {
          MessageDialog.openInformation(getShell(event),UIText.MergeAction_MergeCanceledTitle,UIText.MergeAction_MergeCanceledMessage);
        }
 catch (        ExecutionException e) {
          Activator.handleError(UIText.MergeAction_MergeCanceledMessage,null,true);
        }
      }
    }
);
  }
 else   if (!result.isOK()) {
    Activator.handleError(result.getMessage(),result.getException(),true);
  }
 else {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        try {
          MessageDialog.openInformation(getShell(event),UIText.MergeAction_MergeResultTitle,op.getResult().toString());
        }
 catch (        ExecutionException e) {
          Activator.handleError(op.getResult().toString(),null,true);
        }
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void done(IJobChangeEvent cevent){
  IStatus result=cevent.getJob().getResult();
  if (result.getSeverity() == IStatus.CANCEL) {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        MessageDialog.openInformation(shell,UIText.MergeAction_MergeCanceledTitle,UIText.MergeAction_MergeCanceledMessage);
      }
    }
);
  }
 else   if (!result.isOK()) {
    Activator.handleError(result.getMessage(),result.getException(),true);
  }
 else {
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        MessageDialog.openInformation(shell,UIText.MergeAction_MergeResultTitle,op.getResult().toString());
      }
    }
);
  }
}
Program: 7837
Project: 7837
Buggy source:
private void openFileInEditor(FileDiff d){
  try {
    IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchPage page=window.getActivePage();
    IFileRevision rev=CompareUtils.getFileRevision(d.path,d.commit,db,d.blobs[1]);
    if (rev != null)     EgitUiEditorUtils.openEditor(page,rev,new NullProgressMonitor());
 else {
      String message=NLS.bind(UIText.CommitFileDiffViewer_notContainedInCommit,d.path,d.commit.getId().getName());
      Activator.showError(message,null);
    }
  }
 catch (  IOException e) {
    Activator.logError(UIText.GitHistoryPage_openFailed,e);
    Activator.showError(UIText.GitHistoryPage_openFailed,null);
  }
catch (  CoreException e) {
    Activator.logError(UIText.GitHistoryPage_openFailed,e);
    Activator.showError(UIText.GitHistoryPage_openFailed,null);
  }
}

Fixed version (ground truth):
private void openFileInEditor(FileDiff d){
  try {
    IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchPage page=window.getActivePage();
    IFileRevision rev=CompareUtils.getFileRevision(d.path,d.change.equals("String_Node_Str") ? d.commit.getParent(0) : d.commit,db,d.change.equals("String_Node_Str") ? d.blobs[0] : d.blobs[1]);
    if (rev != null)     EgitUiEditorUtils.openEditor(page,rev,new NullProgressMonitor());
 else {
      String message=NLS.bind(UIText.CommitFileDiffViewer_notContainedInCommit,d.path,d.commit.getId().getName());
      Activator.showError(message,null);
    }
  }
 catch (  IOException e) {
    Activator.logError(UIText.GitHistoryPage_openFailed,e);
    Activator.showError(UIText.GitHistoryPage_openFailed,null);
  }
catch (  CoreException e) {
    Activator.logError(UIText.GitHistoryPage_openFailed,e);
    Activator.showError(UIText.GitHistoryPage_openFailed,null);
  }
}
Program: 7838
Project: 7838
Buggy source:
private void openFileInEditor(FileDiff d){
  try {
    IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchPage page=window.getActivePage();
    IFileRevision rev=CompareUtils.getFileRevision(d.path,d.commit,db,d.blobs[1]);
    if (rev != null)     EgitUiEditorUtils.openEditor(page,rev,new NullProgressMonitor());
 else {
      String message=NLS.bind(UIText.CommitFileDiffViewer_notContainedInCommit,d.path,d.commit.getId().getName());
      Activator.showError(message,null);
    }
  }
 catch (  IOException e) {
    Activator.logError(UIText.GitHistoryPage_openFailed,e);
    Activator.showError(UIText.GitHistoryPage_openFailed,null);
  }
catch (  CoreException e) {
    Activator.logError(UIText.GitHistoryPage_openFailed,e);
    Activator.showError(UIText.GitHistoryPage_openFailed,null);
  }
}

Fixed version (ground truth):
private void openFileInEditor(FileDiff d){
  try {
    IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchPage page=window.getActivePage();
    IFileRevision rev=CompareUtils.getFileRevision(d.path,d.change.equals("String_Node_Str") ? d.commit.getParent(0) : d.commit,db,d.change.equals("String_Node_Str") ? d.blobs[0] : d.blobs[1]);
    if (rev != null)     EgitUiEditorUtils.openEditor(page,rev,new NullProgressMonitor());
 else {
      String message=NLS.bind(UIText.CommitFileDiffViewer_notContainedInCommit,d.path,d.commit.getId().getName());
      Activator.showError(message,null);
    }
  }
 catch (  IOException e) {
    Activator.logError(UIText.GitHistoryPage_openFailed,e);
    Activator.showError(UIText.GitHistoryPage_openFailed,null);
  }
catch (  CoreException e) {
    Activator.logError(UIText.GitHistoryPage_openFailed,e);
    Activator.showError(UIText.GitHistoryPage_openFailed,null);
  }
}
Program: 7839
Project: 7839
Buggy source:
/** 
 * Comparing two folders that have different path should return false.
 * @throws Exception
 */
@Test @SuppressWarnings("String_Node_Str") public void shouldReturnFalseWhenComparingContainerAndContainer() throws Exception {
  GitResourceVariantComparator grvc=new GitResourceVariantComparator(null);
  IPath localPath=createMock(IPath.class);
  replay(localPath);
  IContainer local=createMock(IContainer.class);
  expect(local.exists()).andReturn(true);
  expect(local.getFullPath()).andReturn(localPath);
  replay(local);
  File file=testRepo.createFile(iProject,"String_Node_Str" + File.separator + "String_Node_Str");
  RevCommit commit=testRepo.addAndCommit(iProject,file,"String_Node_Str");
  String path=Repository.stripWorkDir(repo.getWorkTree(),file);
  GitFolderResourceVariant remote=new GitFolderResourceVariant(repo,commit.getTree(),path);
  assertFalse(grvc.compare(local,remote));
  verify(local,localPath);
}

Fixed version (ground truth):
/** 
 * Comparing two folders that have different path should return false.
 * @throws Exception
 */
@Test @SuppressWarnings("String_Node_Str") public void shouldReturnFalseWhenComparingContainerAndContainer() throws Exception {
  GitResourceVariantComparator grvc=new GitResourceVariantComparator(null);
  IPath localPath=createMock(IPath.class);
  replay(localPath);
  IContainer local=createMock(IContainer.class);
  expect(local.exists()).andReturn(true).times(2);
  expect(local.getFullPath()).andReturn(localPath);
  replay(local);
  File file=testRepo.createFile(iProject,"String_Node_Str" + File.separator + "String_Node_Str");
  RevCommit commit=testRepo.addAndCommit(iProject,file,"String_Node_Str");
  String path=Repository.stripWorkDir(repo.getWorkTree(),file);
  GitFolderResourceVariant remote=new GitFolderResourceVariant(repo,commit.getTree(),path);
  assertFalse(grvc.compare(local,remote));
  verify(local,localPath);
}
Program: 7840
Project: 7840
Buggy source:
/** 
 * When comparing two folders that have same path, compare() method should return true.
 * @throws Exception
 */
@Test @SuppressWarnings("String_Node_Str") public void shouldReturnTrueWhenComparingContainerAndContainer() throws Exception {
  GitResourceVariantComparator grvc=new GitResourceVariantComparator(null);
  File file=testRepo.createFile(iProject,"String_Node_Str" + File.separator + "String_Node_Str");
  RevCommit commit=testRepo.addAndCommit(iProject,file,"String_Node_Str");
  String path=Repository.stripWorkDir(repo.getWorkTree(),file);
  IPath iPath=new Path(File.separator + path);
  IContainer local=createMock(IContainer.class);
  expect(local.exists()).andReturn(true);
  expect(local.getFullPath()).andReturn(iPath).anyTimes();
  replay(local);
  GitFolderResourceVariant remote=new GitFolderResourceVariant(repo,commit.getTree(),path);
  assertTrue(grvc.compare(local,remote));
  verify(local);
}

Fixed version (ground truth):
/** 
 * When comparing two folders that have same path, compare() method should return true.
 * @throws Exception
 */
@Test @SuppressWarnings("String_Node_Str") public void shouldReturnTrueWhenComparingContainerAndContainer() throws Exception {
  GitResourceVariantComparator grvc=new GitResourceVariantComparator(null);
  File file=testRepo.createFile(iProject,"String_Node_Str" + File.separator + "String_Node_Str");
  RevCommit commit=testRepo.addAndCommit(iProject,file,"String_Node_Str");
  String path=Repository.stripWorkDir(repo.getWorkTree(),file);
  IPath iPath=new Path(File.separator + path);
  IContainer local=createMock(IContainer.class);
  expect(local.exists()).andReturn(true).times(2);
  expect(local.getFullPath()).andReturn(iPath).anyTimes();
  replay(local);
  GitFolderResourceVariant remote=new GitFolderResourceVariant(repo,commit.getTree(),path);
  assertTrue(grvc.compare(local,remote));
  verify(local);
}
Program: 7843
Project: 7843
Buggy source:
public void createControl(Composite parent){
  initializeDialogUnits(parent);
  Composite workArea=new Composite(parent,SWT.NONE);
  setControl(workArea);
  workArea.setLayout(new GridLayout(2,false));
  workArea.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
  new Label(workArea,SWT.NONE).setText(UIText.GitCreateGeneralProjectPage_ProjectNameLabel);
  projectText=new Text(workArea,SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(projectText);
  projectText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      checkPage();
    }
  }
);
  new Label(workArea,SWT.NONE).setText(UIText.GitCreateGeneralProjectPage_DirLabel);
  directoryText=new Text(workArea,SWT.BORDER);
  directoryText.setEnabled(false);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(directoryText);
  Dialog.applyDialogFont(workArea);
}

Fixed version (ground truth):
public void createControl(Composite parent){
  initializeDialogUnits(parent);
  Composite workArea=new Composite(parent,SWT.NONE);
  setControl(workArea);
  workArea.setLayout(new GridLayout(2,false));
  workArea.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
  new Label(workArea,SWT.NONE).setText(UIText.GitCreateGeneralProjectPage_ProjectNameLabel);
  projectText=new Text(workArea,SWT.BORDER);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(projectText);
  if (defaultLocation)   projectText.setEnabled(false);
 else   projectText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      checkPage();
    }
  }
);
  new Label(workArea,SWT.NONE).setText(UIText.GitCreateGeneralProjectPage_DirLabel);
  directoryText=new Text(workArea,SWT.BORDER);
  directoryText.setEnabled(false);
  GridDataFactory.fillDefaults().grab(true,false).applyTo(directoryText);
  Dialog.applyDialogFont(workArea);
}
Program: 7844
Project: 7844
Buggy source:
/** 
 */
public void importProjects(){
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
switch (mySelectionPage.getWizardSelection()) {
case GitSelectWizardPage.EXISTING_PROJECTS_WIZARD:
        myProjectsImportPage.createProjects();
      break;
case GitSelectWizardPage.NEW_WIZARD:
    new NewWizardAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()).run();
  break;
case GitSelectWizardPage.GENERAL_WIZARD:
try {
  final String projectName=myCreateGeneralProjectPage.getProjectName();
  getContainer().run(true,false,new WorkspaceModifyOperation(){
    @Override protected void execute(    IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
      final IProjectDescription desc=ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
      desc.setLocation(new Path(myGitDir));
      IProject prj=ResourcesPlugin.getWorkspace().getRoot().getProject(desc.getName());
      prj.create(desc,monitor);
      prj.open(monitor);
      ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_ONE,monitor);
    }
  }
);
}
 catch (InvocationTargetException e1) {
  Activator.handleError(e1.getMessage(),e1.getTargetException(),true);
}
catch (InterruptedException e1) {
  Activator.handleError(e1.getMessage(),e1,true);
}
break;
}
}
}
);
}

Fixed version (ground truth):
/** 
 */
public void importProjects(){
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
switch (mySelectionPage.getWizardSelection()) {
case GitSelectWizardPage.EXISTING_PROJECTS_WIZARD:
        myProjectsImportPage.createProjects();
      break;
case GitSelectWizardPage.NEW_WIZARD:
    new NewWizardAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()).run();
  break;
case GitSelectWizardPage.GENERAL_WIZARD:
try {
  final String projectName=myCreateGeneralProjectPage.getProjectName();
  final boolean defaultLocation=myCreateGeneralProjectPage.isDefaultLocation();
  getContainer().run(true,false,new WorkspaceModifyOperation(){
    @Override protected void execute(    IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
      final IProjectDescription desc=ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
      if (!defaultLocation)       desc.setLocation(new Path(myGitDir));
      IProject prj=ResourcesPlugin.getWorkspace().getRoot().getProject(desc.getName());
      prj.create(desc,monitor);
      prj.open(monitor);
      ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_ONE,monitor);
    }
  }
);
}
 catch (InvocationTargetException e1) {
  Activator.handleError(e1.getMessage(),e1.getTargetException(),true);
}
catch (InterruptedException e1) {
  Activator.handleError(e1.getMessage(),e1,true);
}
break;
}
}
}
);
}
Program: 7845
Project: 7845
Buggy source:
public void run(){
switch (mySelectionPage.getWizardSelection()) {
case GitSelectWizardPage.EXISTING_PROJECTS_WIZARD:
    myProjectsImportPage.createProjects();
  break;
case GitSelectWizardPage.NEW_WIZARD:
new NewWizardAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()).run();
break;
case GitSelectWizardPage.GENERAL_WIZARD:
try {
final String projectName=myCreateGeneralProjectPage.getProjectName();
getContainer().run(true,false,new WorkspaceModifyOperation(){
@Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
  final IProjectDescription desc=ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
  desc.setLocation(new Path(myGitDir));
  IProject prj=ResourcesPlugin.getWorkspace().getRoot().getProject(desc.getName());
  prj.create(desc,monitor);
  prj.open(monitor);
  ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_ONE,monitor);
}
}
);
}
 catch (InvocationTargetException e1) {
Activator.handleError(e1.getMessage(),e1.getTargetException(),true);
}
catch (InterruptedException e1) {
Activator.handleError(e1.getMessage(),e1,true);
}
break;
}
}

Fixed version (ground truth):
public void run(){
switch (mySelectionPage.getWizardSelection()) {
case GitSelectWizardPage.EXISTING_PROJECTS_WIZARD:
    myProjectsImportPage.createProjects();
  break;
case GitSelectWizardPage.NEW_WIZARD:
new NewWizardAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()).run();
break;
case GitSelectWizardPage.GENERAL_WIZARD:
try {
final String projectName=myCreateGeneralProjectPage.getProjectName();
final boolean defaultLocation=myCreateGeneralProjectPage.isDefaultLocation();
getContainer().run(true,false,new WorkspaceModifyOperation(){
@Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
  final IProjectDescription desc=ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
  if (!defaultLocation)   desc.setLocation(new Path(myGitDir));
  IProject prj=ResourcesPlugin.getWorkspace().getRoot().getProject(desc.getName());
  prj.create(desc,monitor);
  prj.open(monitor);
  ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_ONE,monitor);
}
}
);
}
 catch (InvocationTargetException e1) {
Activator.handleError(e1.getMessage(),e1.getTargetException(),true);
}
catch (InterruptedException e1) {
Activator.handleError(e1.getMessage(),e1,true);
}
break;
}
}
Program: 7846
Project: 7846
Buggy source:
@Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
  final IProjectDescription desc=ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
  desc.setLocation(new Path(myGitDir));
  IProject prj=ResourcesPlugin.getWorkspace().getRoot().getProject(desc.getName());
  prj.create(desc,monitor);
  prj.open(monitor);
  ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_ONE,monitor);
}

Fixed version (ground truth):
@Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
  final IProjectDescription desc=ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
  if (!defaultLocation)   desc.setLocation(new Path(myGitDir));
  IProject prj=ResourcesPlugin.getWorkspace().getRoot().getProject(desc.getName());
  prj.create(desc,monitor);
  prj.open(monitor);
  ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_ONE,monitor);
}
Program: 7847
Project: 7847
Buggy source:
/** 
 * @return destination {@link Tree}
 * @throws IOException
 */
public Tree mapDstTree() throws IOException {
  return mapTree(dstRev);
}

Fixed version (ground truth):
/** 
 * @return destination Tree
 * @throws IOException
 */
public Tree mapDstTree() throws IOException {
  return mapTree(dstRev);
}
Program: 7848
Project: 7848
Buggy source:
/** 
 * @return source {@link Tree}
 * @throws IOException
 */
public Tree mapSrcTree() throws IOException {
  return mapTree(srcRev);
}

Fixed version (ground truth):
/** 
 * @return source Tree
 * @throws IOException
 */
public Tree mapSrcTree() throws IOException {
  return mapTree(srcRev);
}
Program: 7849
Project: 7849
Buggy source:
/** 
 * Construct a resource not for a   {@link TreeEntry}
 * @param e The {@link TreeEntry}
 */
public GitResourceNode(TreeEntry e){
  entry=e;
}

Fixed version (ground truth):
/** 
 * Construct a resource not for a TreeEntry
 * @param e The TreeEntry
 */
public GitResourceNode(TreeEntry e){
  entry=e;
}
Program: 7850
Project: 7850
Buggy source:
/** 
 * Returns a status that represents the exceptions collected. If the collector is empty <code>IStatus.OK</code> is returned. Otherwise a MultiStatus containing all collected exceptions is returned.
 * @return a multistatus containing the exceptions collected or IStatus.OKif the collector is empty.
 */
public IStatus getStatus(){
  if (statuses.isEmpty()) {
    return Status.OK_STATUS;
  }
 else {
    final MultiStatus multiStatus=new MultiStatus(pluginId,severity,message,null);
    final Iterator it=statuses.iterator();
    while (it.hasNext()) {
      final IStatus status=(IStatus)it.next();
      multiStatus.merge(status);
    }
    return multiStatus;
  }
}

Fixed version (ground truth):
/** 
 * Returns a status that represents the exceptions collected. If the collector is empty <code>IStatus.OK</code> is returned. Otherwise a MultiStatus containing all collected exceptions is returned.
 * @return a multistatus containing the exceptions collected or IStatus.OKif the collector is empty.
 */
public IStatus getStatus(){
  if (statuses != null && statuses.isEmpty()) {
    return Status.OK_STATUS;
  }
 else {
    final MultiStatus multiStatus=new MultiStatus(pluginId,severity,message,null);
    final Iterator it=statuses.iterator();
    while (it.hasNext()) {
      final IStatus status=(IStatus)it.next();
      multiStatus.merge(status);
    }
    return multiStatus;
  }
}
Program: 7851
Project: 7851
Buggy source:
/** 
 * @return destination {@link Tree}
 * @throws IOException
 */
public Tree mapDstTree() throws IOException {
  return mapTree(dstRev);
}

Fixed version (ground truth):
/** 
 * @return destination Tree
 * @throws IOException
 */
public Tree mapDstTree() throws IOException {
  return mapTree(dstRev);
}
Program: 7852
Project: 7852
Buggy source:
/** 
 * @return source {@link Tree}
 * @throws IOException
 */
public Tree mapSrcTree() throws IOException {
  return mapTree(srcRev);
}

Fixed version (ground truth):
/** 
 * @return source Tree
 * @throws IOException
 */
public Tree mapSrcTree() throws IOException {
  return mapTree(srcRev);
}
Program: 7853
Project: 7853
Buggy source:
/** 
 * Construct a resource not for a   {@link TreeEntry}
 * @param e The {@link TreeEntry}
 */
public GitResourceNode(TreeEntry e){
  entry=e;
}

Fixed version (ground truth):
/** 
 * Construct a resource not for a TreeEntry
 * @param e The TreeEntry
 */
public GitResourceNode(TreeEntry e){
  entry=e;
}
Program: 7854
Project: 7854
Buggy source:
public void execute(IAction action) throws InvocationTargetException {
  final IResource resource=getSelectedResources()[0];
  final RepositoryMapping mapping=RepositoryMapping.getMapping(resource.getProject());
  final Repository repository=mapping.getRepository();
  final String gitPath=mapping.getRepoRelativePath(resource);
  final IFile baseFile=(IFile)resource;
  final ITypedElement base=SaveableCompareEditorInput.createFileElement(baseFile);
  ITypedElement next;
  try {
    Ref head=repository.getRef(Constants.HEAD);
    RevWalk rw=new RevWalk(repository);
    RevCommit commit=rw.parseCommit(head.getObjectId());
    next=new GitCompareFileRevisionEditorInput.EmptyTypedElement(NLS.bind(UIText.GitHistoryPage_FileNotInCommit,resource.getName(),commit));
    TreeWalk w=TreeWalk.forPath(repository,gitPath,commit.getTree());
    if (w != null) {
      final IFileRevision nextFile=GitFileRevision.inCommit(repository,commit,gitPath,null);
      next=new FileRevisionTypedElement(nextFile);
    }
  }
 catch (  IOException e) {
    throw new InvocationTargetException(e);
  }
  final GitCompareFileRevisionEditorInput in=new GitCompareFileRevisionEditorInput(base,next,null);
  CompareUI.openCompareEditor(in);
}

Fixed version (ground truth):
public void execute(IAction action) throws InvocationTargetException {
  final IResource resource=getSelectedResources()[0];
  final RepositoryMapping mapping=RepositoryMapping.getMapping(resource.getProject());
  final Repository repository=mapping.getRepository();
  final String gitPath=mapping.getRepoRelativePath(resource);
  final IFile baseFile=(IFile)resource;
  final ITypedElement base=SaveableCompareEditorInput.createFileElement(baseFile);
  ITypedElement next;
  try {
    Ref head=repository.getRef(Constants.HEAD);
    RevWalk rw=new RevWalk(repository);
    RevCommit commit=rw.parseCommit(head.getObjectId());
    next=CompareUtils.getFileRevisionTypedElement(gitPath,commit,repository);
  }
 catch (  IOException e) {
    throw new InvocationTargetException(e);
  }
  final GitCompareFileRevisionEditorInput in=new GitCompareFileRevisionEditorInput(base,next,null);
  CompareUI.openCompareEditor(in);
}
Program: 7855
Project: 7855
Buggy source:
private void discardChange(IResource res) throws IOException {
  IProject[] proj=new IProject[]{res.getProject()};
  Repository repository=getRepositoriesFor(proj)[0];
  String resRelPath=RepositoryMapping.getMapping(res).getRepoRelativePath(res);
  Entry e=repository.getIndex().getEntry(resRelPath);
  if (e != null && e.getStage() == 0 && e.isModified(repository.getWorkDir())) {
    repository.getIndex().checkoutEntry(repository.getWorkDir(),e);
    try {
      res.refreshLocal(0,new NullProgressMonitor());
    }
 catch (    CoreException e1) {
      MessageDialog.openError(getShell(),UIText.DiscardChangesAction_refreshErrorTitle,UIText.DiscardChangesAction_refreshErrorMessage);
    }
    repository.getIndex().write();
  }
}

Fixed version (ground truth):
private void discardChange(IResource res) throws IOException {
  IProject[] proj=new IProject[]{res.getProject()};
  Repository repository=getRepositoriesFor(proj)[0];
  String resRelPath=RepositoryMapping.getMapping(res).getRepoRelativePath(res);
  Entry e=repository.getIndex().getEntry(resRelPath);
  if (e != null && e.getStage() == 0 && e.isModified(repository.getWorkDir())) {
    repository.getIndex().checkoutEntry(repository.getWorkDir(),e);
    try {
      res.refreshLocal(0,new NullProgressMonitor());
    }
 catch (    CoreException e1) {
      Activator.handleError(UIText.DiscardChangesAction_refreshErrorMessage,e1,true);
    }
    repository.getIndex().write();
  }
}