Program: 111712
Project: 111712
Buggy source:
@Test public void testVersionUpdate() throws Exception {
  ConfigServerTestUtils.prepareLocalRepo();
  String uri=ConfigServerTestUtils.copyLocalRepo("String_Node_Str");
  File localRepoFile=ResourceUtils.getFile(uri);
  Git localGit=Git.open(localRepoFile.getAbsoluteFile());
  File remoteDir=new File("String_Node_Str");
  if (remoteDir.exists()) {
    FileSystemUtils.deleteRecursively(remoteDir);
  }
 else {
    remoteDir.mkdirs();
  }
  Git remoteGit=Git.cloneRepository().setURI("String_Node_Str" + localRepoFile.getAbsolutePath()).setDirectory(remoteDir).setBranch("String_Node_Str").setCloneAllBranches(true).call();
  StoredConfig config=localGit.getRepository().getConfig();
  config.setString("String_Node_Str","String_Node_Str","String_Node_Str",remoteDir.getAbsolutePath());
  config.setString("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  config.save();
  CheckoutCommand checkout=localGit.checkout();
  checkout.setName("String_Node_Str");
  Ref localRef=checkout.call();
  String localVersion=localRef.getObjectId().getName();
  checkout=remoteGit.checkout();
  checkout.setName("String_Node_Str");
  Ref remoteRef=checkout.call();
  String remoteVersion=remoteRef.getObjectId().getName();
  assertEquals(remoteVersion,localVersion);
  this.context=new SpringApplicationBuilder(TestConfiguration.class).web(false).properties("String_Node_Str" + "String_Node_Str" + localRepoFile.getAbsolutePath()).run();
  EnvironmentRepository repository=this.context.getBean(EnvironmentRepository.class);
  Environment environment=repository.findOne("String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals(environment.getVersion(),remoteVersion);
  FileOutputStream out=new FileOutputStream(remoteDir.getAbsolutePath() + "String_Node_Str");
  StreamUtils.copy("String_Node_Str",Charset.defaultCharset(),out);
  remoteGit.add().addFilepattern("String_Node_Str").call();
  remoteGit.commit().setMessage("String_Node_Str").call();
  environment=repository.findOne("String_Node_Str","String_Node_Str","String_Node_Str");
  checkout=localGit.checkout();
  checkout.setName("String_Node_Str");
  localRef=checkout.call();
  String updatedLocalVersion=localRef.getObjectId().getName();
  checkout=remoteGit.checkout();
  checkout.setName("String_Node_Str");
  remoteRef=checkout.call();
  String updatedRemoteVersion=remoteRef.getObjectId().getName();
  assertEquals(updatedRemoteVersion,updatedLocalVersion);
  assertNotEquals(updatedRemoteVersion,remoteVersion);
  assertNotEquals(updatedLocalVersion,localVersion);
  assertEquals(environment.getVersion(),updatedRemoteVersion);
}

Fixed version (ground truth):
@Test public void testVersionUpdate() throws Exception {
  ConfigServerTestUtils.prepareLocalRepo();
  String uri=ConfigServerTestUtils.copyLocalRepo("String_Node_Str");
  File localRepoFile=ResourceUtils.getFile(uri);
  Git localGit=Git.open(localRepoFile.getAbsoluteFile());
  File remoteDir=new File("String_Node_Str");
  if (remoteDir.exists()) {
    FileSystemUtils.deleteRecursively(remoteDir);
  }
 else {
    remoteDir.mkdirs();
  }
  Git remoteGit=Git.cloneRepository().setURI("String_Node_Str" + localRepoFile.getAbsolutePath()).setDirectory(remoteDir).setBranch("String_Node_Str").setCloneAllBranches(true).call();
  StoredConfig config=localGit.getRepository().getConfig();
  config.setString("String_Node_Str","String_Node_Str","String_Node_Str",remoteDir.getAbsolutePath());
  config.setString("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  config.save();
  CheckoutCommand checkout=localGit.checkout();
  checkout.setName("String_Node_Str");
  Ref localRef=checkout.call();
  String localVersion=localRef.getObjectId().getName();
  checkout=remoteGit.checkout();
  checkout.setName("String_Node_Str");
  Ref remoteRef=checkout.call();
  String remoteVersion=remoteRef.getObjectId().getName();
  assertEquals(remoteVersion,localVersion);
  this.context=new SpringApplicationBuilder(TestConfiguration.class).web(false).properties("String_Node_Str" + "String_Node_Str" + localRepoFile.getAbsolutePath()).run();
  EnvironmentRepository repository=this.context.getBean(EnvironmentRepository.class);
  Environment environment=repository.findOne("String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals(environment.getVersion(),remoteVersion);
  FileOutputStream out=new FileOutputStream(remoteDir.getAbsolutePath() + "String_Node_Str");
  StreamUtils.copy("String_Node_Str",Charset.defaultCharset(),out);
  remoteGit.add().addFilepattern("String_Node_Str").call();
  remoteGit.commit().setMessage("String_Node_Str").call();
  environment=repository.findOne("String_Node_Str","String_Node_Str","String_Node_Str");
  checkout=localGit.checkout();
  checkout.setName("String_Node_Str");
  localRef=checkout.call();
  String updatedLocalVersion=localRef.getObjectId().getName();
  checkout=remoteGit.checkout();
  checkout.setName("String_Node_Str");
  remoteRef=checkout.call();
  String updatedRemoteVersion=remoteRef.getObjectId().getName();
  Assert.assertEquals(updatedRemoteVersion,updatedLocalVersion);
  Assert.assertNotEquals(updatedRemoteVersion,remoteVersion);
  Assert.assertNotEquals(updatedLocalVersion,localVersion);
  Assert.assertEquals(environment.getVersion(),updatedRemoteVersion);
}