Source:
public static HttpConnection getLfsConnection(Repository db, String method, String purpose) throws IOException { StoredConfig config = db.getConfig(); String lfsEndpoint = config.getString("lfs", null, "url"); Map<String, String> additionalHeaders = new TreeMap<>(); if (lfsEndpoint == null) { String remoteUrl = null; for (String remote : db.getRemoteNames()) { lfsEndpoint = config.getString("lfs", remote, "url"); if (lfsEndpoint == null && (remote.equals(Constants.DEFAULT_REMOTE_NAME))) { remoteUrl = config.getString("remote", remote, "url"); } break; } if (lfsEndpoint == null && remoteUrl != null) { try { URIish u = new URIish(remoteUrl); if ("ssh".equals(u.getScheme())) { Protocol.ExpiringAction action = null; action = getCachedSshAuthentication(db, purpose, remoteUrl, u, action); additionalHeaders.putAll(action.header); lfsEndpoint = action.href; } else { lfsEndpoint = remoteUrl + "/info/lfs"; } } catch (Exception e) { lfsEndpoint = null; } } else { lfsEndpoint = lfsEndpoint + "/info/lfs"; } } if (lfsEndpoint == null) { throw new IOException( "need to download object from lfs server but couldn't determine lfs server url"); } URL url = new URL(lfsEndpoint + "/objects/batch"); HttpConnection connection = HttpTransport.getConnectionFactory().create( url, HttpSupport.proxyFor(ProxySelector.getDefault(), url)); connection.setDoOutput(true); if (url.getProtocol().equals("https") && !config.getBoolean("http", "sslVerify", true)) { HttpSupport.disableSslVerify(connection); } connection.setRequestMethod(method); connection.setRequestProperty(HDR_ACCEPT, Protocol.CONTENTTYPE_VND_GIT_LFS_JSON); connection.setRequestProperty(HDR_CONTENT_TYPE, Protocol.CONTENTTYPE_VND_GIT_LFS_JSON); additionalHeaders .forEach((k, v) -> connection.setRequestProperty(k, v)); return connection; }

Target:
public static HttpConnection getLfsConnection(Repository db, String method, String purpose) throws IOException { StoredConfig config = db.getConfig(); String lfsEndpoint = config.getString("lfs", null, "url"); Map<String, String> additionalHeaders = new TreeMap<>(); if (lfsEndpoint == null) { String remoteUrl = null; for (String remote : db.getRemoteNames()) { lfsEndpoint = config.getString("lfs", remote, "url"); if (lfsEndpoint == null && (remote.equals(Constants.DEFAULT_REMOTE_NAME))) { remoteUrl = config.getString("remote", remote, "url"); } break; } if (lfsEndpoint == null && remoteUrl != null) { try { URIish u = new URIish(remoteUrl); if ("ssh".equals(u.getScheme())) { Protocol.ExpiringAction action = getCachedSshAuthentication( db, purpose, remoteUrl, u); additionalHeaders.putAll(action.header); lfsEndpoint = action.href; } else { lfsEndpoint = remoteUrl + "/info/lfs"; } } catch (Exception e) { lfsEndpoint = null; } } else { lfsEndpoint = lfsEndpoint + "/info/lfs"; } } if (lfsEndpoint == null) { throw new IOException( "need to download object from lfs server but couldn't determine lfs server url"); } URL url = new URL(lfsEndpoint + "/objects/batch"); HttpConnection connection = HttpTransport.getConnectionFactory().create( url, HttpSupport.proxyFor(ProxySelector.getDefault(), url)); connection.setDoOutput(true); if (url.getProtocol().equals("https") && !config.getBoolean("http", "sslVerify", true)) { HttpSupport.disableSslVerify(connection); } connection.setRequestMethod(method); connection.setRequestProperty(HDR_ACCEPT, Protocol.CONTENTTYPE_VND_GIT_LFS_JSON); connection.setRequestProperty(HDR_CONTENT_TYPE, Protocol.CONTENTTYPE_VND_GIT_LFS_JSON); additionalHeaders .forEach((k, v) -> connection.setRequestProperty(k, v)); return connection; }