-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed mapping of extracted statements in commit
- Loading branch information
Showing
14 changed files
with
3,895 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
src/test/resources/mappings/jgit-7ff6eb584cf8b83f83a3b5edf897feb53dbf42c0.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
private sendPack() : void -> private sendPack(sideband boolean) : void | ||
line range:771-771==line range:830-830 | ||
line range:824-824==line range:883-883 | ||
line range:826-826==line range:885-885 | ||
line range:828-828==line range:887-887 | ||
line range:831-831==line range:890-890 | ||
line range:833-833==line range:892-892 | ||
line range:835-835==line range:894-894 | ||
line range:837-837==line range:896-896 | ||
line range:838-838==line range:897-897 | ||
line range:839-839==line range:898-898 | ||
line range:844-844==line range:903-903 | ||
line range:849-849==line range:908-908 | ||
line range:851-851==line range:910-910 | ||
line range:853-853==line range:912-912 | ||
line range:857-857==line range:916-916 | ||
line range:859-859==line range:918-918 | ||
line range:861-861==line range:920-920 | ||
line range:863-863==line range:922-922 | ||
line range:865-865==line range:924-924 | ||
line range:869-869==line range:928-928 | ||
line range:870-870==line range:929-929 | ||
line range:873-873==line range:932-932 | ||
line range:874-874==line range:933-933 | ||
line range:875-875==line range:934-934 | ||
line range:879-879==line range:938-938 | ||
line range:883-883==line range:942-942 | ||
line range:886-886==line range:945-945 | ||
line range:772-772==line range:831-831 | ||
line range:773-773==line range:832-832 | ||
line range:776-776==line range:835-835 | ||
line range:778-778==line range:837-837 | ||
line range:780-781==line range:839-840 | ||
line range:783-784==line range:842-843 | ||
line range:785-785==line range:844-844 | ||
line range:791-791==line range:850-850 | ||
line range:793-793==line range:852-852 | ||
line range:797-797==line range:856-856 | ||
line range:798-800==line range:857-859 | ||
line range:801-801==line range:860-860 | ||
line range:802-802==line range:861-861 | ||
line range:804-804==line range:863-863 | ||
line range:807-807==line range:866-866 | ||
line range:809-809==line range:868-868 | ||
line range:810-810==line range:869-869 | ||
line range:812-812==line range:871-871 | ||
line range:813-813==line range:872-872 | ||
line range:814-814==line range:873-873 | ||
line range:815-815==line range:874-874 | ||
line range:816-816==line range:875-875 | ||
line range:819-819==line range:878-878 | ||
line range:822-822==line range:881-881 | ||
line range:777-778==line range:836-837 | ||
line range:782-786==line range:841-845 | ||
line range:775-787==line range:834-846 | ||
line range:790-794==line range:849-853 | ||
line range:789-805==line range:848-864 | ||
line range:796-803==line range:855-862 | ||
line range:795-805==line range:854-864 | ||
line range:808-809==line range:867-868 | ||
line range:825-826==line range:884-885 | ||
line range:823-826==line range:882-885 | ||
line range:821-826==line range:880-885 | ||
line range:820-827==line range:879-886 | ||
line range:818-829==line range:877-888 | ||
line range:832-840==line range:891-899 | ||
line range:848-849==line range:907-908 | ||
line range:852-853==line range:911-912 | ||
line range:847-854==line range:906-913 | ||
line range:856-857==line range:915-916 | ||
line range:860-861==line range:919-920 | ||
line range:864-865==line range:923-924 | ||
line range:843-866==line range:902-925 | ||
line range:842-867==line range:901-926 | ||
line range:872-876==line range:931-935 | ||
line range:811-880==line range:870-939 | ||
line range:878-880==line range:937-939 | ||
line range:882-883==line range:941-942 | ||
line range:885-886==line range:944-945 | ||
line range:782-786==line range:841-845 | ||
line range:775-787==line range:834-846 | ||
line range:790-792==line range:849-851 | ||
line range:792-794==line range:851-853 | ||
line range:796-803==line range:855-862 | ||
line range:820-827==line range:879-886 | ||
line range:818-829==line range:877-888 | ||
line range:832-834==line range:891-893 | ||
line range:834-840==line range:893-899 | ||
line range:847-850==line range:906-909 | ||
line range:850-854==line range:909-913 | ||
line range:843-866==line range:902-925 | ||
line range:842-867==line range:901-926 | ||
line range:872-876==line range:931-935 | ||
private sendPack() : void -> private sendPack() : void | ||
line range:758-759==line range:774-775 | ||
line range:764-764==line range:780-780 | ||
line range:766-768==line range:782-784 | ||
line range:765-768==line range:781-784 | ||
line range:761-769==line range:777-785 | ||
line range:761-769==line range:777-785 |
179 changes: 179 additions & 0 deletions
179
...56b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
/* | ||
* Copyright (C) 2009-2010, Google Inc. | ||
* and other copyright owners as documented in the project's IP log. | ||
* | ||
* This program and the accompanying materials are made available | ||
* under the terms of the Eclipse Distribution License v1.0 which | ||
* accompanies this distribution, is reproduced below, and is | ||
* available at http://www.eclipse.org/org/documents/edl-v10.php | ||
* | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or | ||
* without modification, are permitted provided that the following | ||
* conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* | ||
* - Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* | ||
* - Neither the name of the Eclipse Foundation, Inc. nor the | ||
* names of its contributors may be used to endorse or promote | ||
* products derived from this software without specific prior | ||
* written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
package org.eclipse.jgit.http.server; | ||
|
||
import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN; | ||
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; | ||
import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED; | ||
import static javax.servlet.http.HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE; | ||
import static org.eclipse.jgit.http.server.ServletUtils.ATTRIBUTE_HANDLER; | ||
import static org.eclipse.jgit.http.server.ServletUtils.getInputStream; | ||
import static org.eclipse.jgit.http.server.ServletUtils.getRepository; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
import javax.servlet.Filter; | ||
import javax.servlet.FilterChain; | ||
import javax.servlet.FilterConfig; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.ServletRequest; | ||
import javax.servlet.ServletResponse; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import org.eclipse.jgit.lib.Repository; | ||
import org.eclipse.jgit.transport.ReceivePack; | ||
import org.eclipse.jgit.transport.RefAdvertiser.PacketLineOutRefAdvertiser; | ||
import org.eclipse.jgit.transport.resolver.ReceivePackFactory; | ||
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; | ||
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; | ||
|
||
/** Server side implementation of smart push over HTTP. */ | ||
class ReceivePackServlet extends HttpServlet { | ||
private static final String REQ_TYPE = "application/x-git-receive-pack-request"; | ||
|
||
private static final String RSP_TYPE = "application/x-git-receive-pack-result"; | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
static class InfoRefs extends SmartServiceInfoRefs { | ||
private final ReceivePackFactory<HttpServletRequest> receivePackFactory; | ||
|
||
InfoRefs(ReceivePackFactory<HttpServletRequest> receivePackFactory, | ||
List<Filter> filters) { | ||
super("git-receive-pack", filters); | ||
this.receivePackFactory = receivePackFactory; | ||
} | ||
|
||
@Override | ||
protected void begin(HttpServletRequest req, Repository db) | ||
throws IOException, ServiceNotEnabledException, | ||
ServiceNotAuthorizedException { | ||
ReceivePack rp = receivePackFactory.create(req, db); | ||
req.setAttribute(ATTRIBUTE_HANDLER, rp); | ||
} | ||
|
||
@Override | ||
protected void advertise(HttpServletRequest req, | ||
PacketLineOutRefAdvertiser pck) throws IOException, | ||
ServiceNotEnabledException, ServiceNotAuthorizedException { | ||
ReceivePack rp = (ReceivePack) req.getAttribute(ATTRIBUTE_HANDLER); | ||
try { | ||
rp.sendAdvertisedRefs(pck); | ||
} finally { | ||
rp.getRevWalk().release(); | ||
} | ||
} | ||
} | ||
|
||
static class Factory implements Filter { | ||
private final ReceivePackFactory<HttpServletRequest> receivePackFactory; | ||
|
||
Factory(ReceivePackFactory<HttpServletRequest> receivePackFactory) { | ||
this.receivePackFactory = receivePackFactory; | ||
} | ||
|
||
public void doFilter(ServletRequest request, ServletResponse response, | ||
FilterChain chain) throws IOException, ServletException { | ||
HttpServletRequest req = (HttpServletRequest) request; | ||
HttpServletResponse rsp = (HttpServletResponse) response; | ||
ReceivePack rp; | ||
try { | ||
rp = receivePackFactory.create(req, getRepository(req)); | ||
} catch (ServiceNotAuthorizedException e) { | ||
rsp.sendError(SC_UNAUTHORIZED); | ||
return; | ||
|
||
} catch (ServiceNotEnabledException e) { | ||
RepositoryFilter.sendError(SC_FORBIDDEN, req, rsp); | ||
return; | ||
} | ||
|
||
try { | ||
req.setAttribute(ATTRIBUTE_HANDLER, rp); | ||
chain.doFilter(req, rsp); | ||
} finally { | ||
req.removeAttribute(ATTRIBUTE_HANDLER); | ||
} | ||
} | ||
|
||
public void init(FilterConfig filterConfig) throws ServletException { | ||
// Nothing. | ||
} | ||
|
||
public void destroy() { | ||
// Nothing. | ||
} | ||
} | ||
|
||
@Override | ||
public void doPost(final HttpServletRequest req, | ||
final HttpServletResponse rsp) throws IOException { | ||
if (!REQ_TYPE.equals(req.getContentType())) { | ||
rsp.sendError(SC_UNSUPPORTED_MEDIA_TYPE); | ||
return; | ||
} | ||
|
||
ReceivePack rp = (ReceivePack) req.getAttribute(ATTRIBUTE_HANDLER); | ||
try { | ||
rp.setBiDirectionalPipe(false); | ||
rsp.setContentType(RSP_TYPE); | ||
|
||
final SmartOutputStream out = new SmartOutputStream(req, rsp) { | ||
@Override | ||
public void flush() throws IOException { | ||
doFlush(); | ||
} | ||
}; | ||
rp.receive(getInputStream(req), out, null); | ||
out.close(); | ||
} catch (IOException e) { | ||
getServletContext().log(HttpServerText.get().internalErrorDuringReceivePack, e); | ||
rsp.sendError(SC_INTERNAL_SERVER_ERROR); | ||
return; | ||
} | ||
} | ||
} |
Oops, something went wrong.