Browse Source

InfoRefsServlet: Refactor to not use deprecated methods

- Replace RefDatabase#getRefs(String) with #getRefsByPrefix(String)
- Replace RefAdvertiser#send(Map<String, Ref>) with #send(Collection<Ref>)

Bug: 534731
Change-Id: I25b617c3b0c54793cf4ab5b62f002e17745a5377
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.1
David Pursehouse 7 years ago
parent
commit
a2b10e56bd
  1. 8
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java

8
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java

@ -44,18 +44,15 @@
package org.eclipse.jgit.http.server;
import static org.eclipse.jgit.http.server.ServletUtils.getRepository;
import static org.eclipse.jgit.lib.RefDatabase.ALL;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Map;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.RefAdvertiser;
import org.eclipse.jgit.util.HttpSupport;
@ -94,10 +91,7 @@ class InfoRefsServlet extends HttpServlet {
};
adv.init(db);
adv.setDerefTags(true);
Map<String, Ref> refs = db.getRefDatabase().getRefs(ALL);
refs.remove(Constants.HEAD);
adv.send(refs);
adv.send(db.getRefDatabase().getRefsByPrefix(Constants.R_REFS));
}
}
}

Loading…
Cancel
Save