Use consistent lowercase for "gitweb"

We had inconsistent class and variable naming in Gerrit to the point
that (prior to I640e645f6) there were two completely different classes
named "GitwebConfig" and "GitWebConfig".

In the official upstream Git documentation, this command line tool is
most often referred to as "gitweb". Standardize on this
capitalization in text. It may still be capitalized at the beginning
of sentences, or where required by programming language style (e.g.
Java class names).

The only exceptions are:
 - MSysGit's wiki page is entitled GitWeb, so use that when referring
   specifically to that page.
 - Old release notes were not touched.

Change-Id: I497477c264e9cc1380c520618f8edf13e7226c9d
This commit is contained in:
Dave Borowitz
2015-06-05 15:22:23 -07:00
parent 2615c38377
commit a3d6788212
29 changed files with 153 additions and 155 deletions

View File

@@ -1763,7 +1763,7 @@ Whether or not Gerrit should encode the generated viewer URL.
+
Gerrit composes the viewer URL using information about the project, branch, file
or commit of the target object to be displayed. Typically viewers such as CGit
and GitWeb do need those parts to be encoded, including the '/' in project's name,
and gitweb do need those parts to be encoded, including the '/' in project's name,
for being correctly parsed.
However other viewers could instead require an unencoded URL (e.g. GitHub web
based viewer)

View File

@@ -67,12 +67,12 @@ able to read the gitweb info for any of the branches in that project.
For the external configuration, gitweb runs under the control of an
external web server, and Gerrit access controls are not enforced. Gerrit
provides configuration parameters for integration with GitWeb.
provides configuration parameters for integration with gitweb.
[[linuxGitWeb]]
==== Linux Installation
===== Install GitWeb
===== Install Gitweb
On Ubuntu:
@@ -86,7 +86,7 @@ With Yum:
$ yum install gitweb
====
===== Configure GitWeb
===== Configure Gitweb
Update `/etc/gitweb.conf`, add the public GIT repositories:
@@ -161,7 +161,7 @@ link:http://localhost/gitweb[http://localhost/gitweb]
[[WindowsGitWeb]]
==== Windows Installation
Instructions are available for installing the GitWeb module distributed with
Instructions are available for installing the gitweb module distributed with
MsysGit:
link:https://github.com/msysgit/msysgit/wiki/GitWeb[GitWeb]
@@ -176,7 +176,7 @@ If you're still having difficulty setting up permissions, you may find this
tech note useful for configuring Apache Service to run under another account.
You must grant the new account link:http://technet.microsoft.com/en-us/library/cc794944(WS.10).aspx["run as service"] permission:
The GitWeb version in msysgit is missing several important and required
The gitweb version in msysgit is missing several important and required
perl modules, including CGI.pm. The perl included with the msysgit distro 1.7.8
is broken.. The link:http://groups.google.com/group/msysgit/browse_thread/thread/ba3501f1f0ed95af[unicore folder is missing along with utf8_heavy.pl and CGI.pm]. You can
verify by checking for perl modules. From an msys console, execute the
@@ -207,7 +207,7 @@ contents: `bin/` `lib/` `site/`
copy the contents of lib into `msysgit/lib/perl5/5.8.8` and overwrite existing files.
==== Enable GitWeb Integration
==== Enable Gitweb Integration
To enable the external gitweb integration, set
link:config-gerrit.html#gitweb.url[gitweb.url] with the URL of your

View File

@@ -166,7 +166,7 @@ Project]
This plugin allows the rendering of Git repository branch network in a
graphical HTML5 Canvas. It is mainly intended to be used as a
"project link" in a GitWeb configuration or by other Gerrit GWT UI
"project link" in a gitweb configuration or by other Gerrit GWT UI
plugins to be plugged elsewhere in Gerrit.
link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/branch-network[

View File

@@ -63,7 +63,7 @@ always see how the access rights were changed and by whom. If a good
commit message is provided you can also see from the history why the
access rights were modified.
If a Git browser such as GitWeb is configured for the Gerrit server you
If a Git browser such as gitweb is configured for the Gerrit server you
can find a link to the history of the `project.config` file in the
Web UI. Otherwise you may inspect the history locally. If you have
cloned the repository you can do this by executing the following

View File

@@ -1165,48 +1165,48 @@ bugs link].
|=================================
[[git-web-info]]
=== GitWebInfo
The `GitWebInfo` entity contains information about the
link:config-gerrit.html#gitweb[GitWeb] configuration.
=== GitwebInfo
The `GitwebInfo` entity contains information about the
link:config-gerrit.html#gitweb[gitweb] configuration.
[options="header",cols="1,6"]
|=======================
|Field Name |Description
|`url` |
The link:config-gerrit.html#gitweb.url[GitWeb base URL].
The link:config-gerrit.html#gitweb.url[gitweb base URL].
|`type` |
The link:config-gerrit.html#gitweb.type[GitWeb type] as
link:#git-web-type-info[GitWebTypeInfo] entity.
The link:config-gerrit.html#gitweb.type[gitweb type] as
link:#git-web-type-info[GitwebTypeInfo] entity.
|=======================
[[git-web-type-info]]
=== GitWebTypeInfo
The `GitWebTypeInfo` entity contains information about the
link:config-gerrit.html#gitweb[GitWeb] configuration.
=== GitwebTypeInfo
The `GitwebTypeInfo` entity contains information about the
link:config-gerrit.html#gitweb[gitweb] configuration.
[options="header",cols="1,^1,5"]
|=============================
|Field Name ||Description
|`name` ||
The link:config-gerrit.html#gitweb.linkname[GitWeb link name].
The link:config-gerrit.html#gitweb.linkname[gitweb link name].
|`revision` |optional|
The link:config-gerrit.html#gitweb.revision[GitWeb revision pattern].
The link:config-gerrit.html#gitweb.revision[gitweb revision pattern].
|`project` |optional|
The link:config-gerrit.html#gitweb.project[GitWeb project pattern].
The link:config-gerrit.html#gitweb.project[gitweb project pattern].
|`branch` |optional|
The link:config-gerrit.html#gitweb.branch[GitWeb branch pattern].
The link:config-gerrit.html#gitweb.branch[gitweb branch pattern].
|`root_tree` |optional|
The link:config-gerrit.html#gitweb.roottree[GitWeb root tree pattern].
The link:config-gerrit.html#gitweb.roottree[gitweb root tree pattern].
|`file` |optional|
The link:config-gerrit.html#gitweb.file[GitWeb file pattern].
The link:config-gerrit.html#gitweb.file[gitweb file pattern].
|`file_history` |optional|
The link:config-gerrit.html#gitweb.filehistory[GitWeb file history
The link:config-gerrit.html#gitweb.filehistory[gitweb file history
pattern].
|`path_separator`||
The link:config-gerrit.html#gitweb.pathSeparator[GitWeb path separator].
The link:config-gerrit.html#gitweb.pathSeparator[gitweb path separator].
|`link_drafts` |optional|
link:config-gerrit.html#gitweb.linkDrafts[Whether Gerrit should provide
links to GitWeb on draft patch set.]
links to gitweb on draft patch set.]
|`url_encode` |optional|
link:config-gerrit.html#gitweb.urlEncode[Whether Gerrit should encode
the generated viewer URL.]
@@ -1300,9 +1300,9 @@ information about Gerrit
Information about the configuration from the
link:config-gerrit.html#gerrit[gerrit] section as link:#gerrit-info[
GerritInfo] entity.
|`git_web` |optional|
Information about the link:config-gerrit.html#gitweb[GitWeb]
configuration as link:#git-web-info[GitWebInfo] entity.
|`gitweb ` |optional|
Information about the link:config-gerrit.html#gitweb[gitweb]
configuration as link:#git-web-info[GitwebInfo] entity.
|`sshd` |optional|
Information about the configuration from the
link:config-gerrit.html#sshd[sshd] section as link:#sshd-info[SshdInfo]

View File

@@ -94,7 +94,7 @@ The commit ID, the parent commit(s) and the link:user-changeid.html[Change-Id] a
displayed with a copy-to-clipboard icon that allows the ID to be copied
into the clipboard.
If a Git web browser, such as GitWeb or Gitiles, is configured, there
If a Git web browser, such as gitweb or Gitiles, is configured, there
is also a link to the commit in the Git web browser.
image::images/user-review-ui-change-screen-commit-info.png[width=800, link="images/user-review-ui-change-screen-commit-info.png"]

View File

@@ -108,7 +108,7 @@ public class ServerInfoIT extends AbstractDaemonTest {
assertThat(i.gerrit.reportBugText).isEqualTo("REPORT BUG");
// gitweb
assertThat(i.gitWeb).isNull();
assertThat(i.gitweb).isNull();
// sshd
assertThat(i.sshd).isNotNull();
@@ -161,7 +161,7 @@ public class ServerInfoIT extends AbstractDaemonTest {
assertThat(i.gerrit.reportBugText).isNull();
// gitweb
assertThat(i.gitWeb).isNull();
assertThat(i.gitweb).isNull();
// sshd
assertThat(i.sshd).isNotNull();

View File

@@ -15,7 +15,7 @@
package com.google.gerrit.common.data;
/** Class to store information about different source browser types. */
public class GitWebType {
public class GitwebType {
private String name;
private String branch;

View File

@@ -21,14 +21,14 @@ import org.junit.Test;
public class EncodePathSeparatorTest {
@Test
public void testDefaultBehaviour() {
assertEquals("a/b", new GitWebType().replacePathSeparator("a/b"));
assertEquals("a/b", new GitwebType().replacePathSeparator("a/b"));
}
@Test
public void testExclamationMark() {
GitWebType gitWebType = new GitWebType();
gitWebType.setPathSeparator('!');
assertEquals("a!b", gitWebType.replacePathSeparator("a/b"));
GitwebType gitwebType = new GitwebType();
gitwebType.setPathSeparator('!');
assertEquals("a!b", gitwebType.replacePathSeparator("a/b"));
}
}

View File

@@ -16,7 +16,7 @@ package com.google.gerrit.client.admin;
import com.google.gerrit.client.Dispatcher;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.config.GitWebInfo;
import com.google.gerrit.client.config.GitwebInfo;
import com.google.gerrit.client.ui.Hyperlink;
import com.google.gerrit.client.ui.ParentProjectBox;
import com.google.gerrit.common.data.AccessSection;
@@ -121,7 +121,7 @@ public class ProjectAccessEditor extends Composite implements
inheritsFrom.getStyle().setDisplay(Display.NONE);
}
GitWebInfo c = Gerrit.info().gitWeb();
GitwebInfo c = Gerrit.info().gitweb();
if (value.isConfigVisible() && c != null) {
history.getStyle().setDisplay(Display.BLOCK);
gitweb.setText(c.getLinkName());

View File

@@ -26,7 +26,7 @@ import com.google.gerrit.client.access.AccessMap;
import com.google.gerrit.client.access.ProjectAccessInfo;
import com.google.gerrit.client.actions.ActionButton;
import com.google.gerrit.client.actions.ActionInfo;
import com.google.gerrit.client.config.GitWebInfo;
import com.google.gerrit.client.config.GitwebInfo;
import com.google.gerrit.client.projects.BranchInfo;
import com.google.gerrit.client.projects.ProjectApi;
import com.google.gerrit.client.rpc.GerritCallback;
@@ -457,7 +457,7 @@ public class ProjectBranchesScreen extends ProjectScreen {
}
void populate(int row, BranchInfo k) {
GitWebInfo c = Gerrit.info().gitWeb();
GitwebInfo c = Gerrit.info().gitweb();
if (k.canDelete()) {
CheckBox sel = new CheckBox();

View File

@@ -19,7 +19,7 @@ import static com.google.gerrit.common.PageLinks.ADMIN_PROJECTS;
import com.google.gerrit.client.Dispatcher;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.WebLinkInfo;
import com.google.gerrit.client.config.GitWebInfo;
import com.google.gerrit.client.config.GitwebInfo;
import com.google.gerrit.client.projects.ProjectInfo;
import com.google.gerrit.client.projects.ProjectMap;
import com.google.gerrit.client.rpc.GerritCallback;
@@ -185,16 +185,16 @@ public class ProjectListScreen extends Screen {
}
private void addWebLinks(int row, ProjectInfo k) {
GitWebInfo gitWebLink = Gerrit.info().gitWeb();
GitwebInfo gitwebLink = Gerrit.info().gitweb();
List<WebLinkInfo> webLinks = Natives.asList(k.webLinks());
if (gitWebLink != null || (webLinks != null && !webLinks.isEmpty())) {
if (gitwebLink != null || (webLinks != null && !webLinks.isEmpty())) {
FlowPanel p = new FlowPanel();
table.setWidget(row, ProjectsTable.C_REPO_BROWSER, p);
if (gitWebLink != null) {
if (gitwebLink != null) {
Anchor a = new Anchor();
a.setText(gitWebLink.getLinkName());
a.setHref(gitWebLink.toProject(k.name_key()));
a.setText(gitwebLink.getLinkName());
a.setHref(gitwebLink.toProject(k.name_key()));
p.add(a);
}
if (webLinks != null) {

View File

@@ -23,7 +23,7 @@ import com.google.gerrit.client.changes.ChangeInfo;
import com.google.gerrit.client.changes.ChangeInfo.CommitInfo;
import com.google.gerrit.client.changes.ChangeInfo.GitPerson;
import com.google.gerrit.client.changes.ChangeInfo.RevisionInfo;
import com.google.gerrit.client.config.GitWebInfo;
import com.google.gerrit.client.config.GitwebInfo;
import com.google.gerrit.client.rpc.Natives;
import com.google.gerrit.client.ui.CommentLinkProcessor;
import com.google.gerrit.client.ui.InlineHyperlink;
@@ -135,7 +135,7 @@ class CommitBox extends Composite {
private void setWebLinks(ChangeInfo change, String revision,
RevisionInfo revInfo) {
GitWebInfo gw = Gerrit.info().gitWeb();
GitwebInfo gw = Gerrit.info().gitweb();
if (gw != null && gw.canLink(revInfo)) {
toAnchor(gw.toRevision(change.project(), revision),
gw.getLinkName());
@@ -184,7 +184,7 @@ class CommitBox extends Composite {
}
private void addLinks(String project, CommitInfo c, FlowPanel panel) {
GitWebInfo gw = Gerrit.info().gitWeb();
GitwebInfo gw = Gerrit.info().gitweb();
if (gw != null) {
Anchor a =
new Anchor(gw.getLinkName(), gw.toRevision(project, c.commit()));

View File

@@ -18,7 +18,7 @@ import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.change.RelatedChanges.ChangeAndCommit;
import com.google.gerrit.client.changes.ChangeInfo.CommitInfo;
import com.google.gerrit.client.changes.Util;
import com.google.gerrit.client.config.GitWebInfo;
import com.google.gerrit.client.config.GitwebInfo;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gwt.core.client.GWT;
@@ -301,7 +301,7 @@ class RelatedChangesTab implements IsWidget {
sb.closeSpan();
sb.openSpan();
GitWebInfo gw = Gerrit.info().gitWeb();
GitwebInfo gw = Gerrit.info().gitweb();
if (gw != null && (!info.hasChangeNumber() || !info.hasRevisionNumber())) {
sb.setStyleName(RelatedChanges.R.css().gitweb());
sb.setAttribute("title", gw.getLinkName());
@@ -335,7 +335,7 @@ class RelatedChangesTab implements IsWidget {
id.getId());
}
GitWebInfo gw = Gerrit.info().gitWeb();
GitwebInfo gw = Gerrit.info().gitweb();
if (gw != null && project != null) {
return gw.toRevision(project, info.commit().commit());
}

View File

@@ -25,9 +25,9 @@ import com.google.gwt.http.client.URL;
import java.util.HashMap;
import java.util.Map;
public class GitWebInfo extends JavaScriptObject {
public class GitwebInfo extends JavaScriptObject {
public final native String url() /*-{ return this.url; }-*/;
public final native GitWebTypeInfo type() /*-{ return this.type; }-*/;
public final native GitwebTypeInfo type() /*-{ return this.type; }-*/;
/**
* Checks whether the given patch set can be linked.
@@ -56,20 +56,20 @@ public class GitWebInfo extends JavaScriptObject {
}
/**
* Returns the name for GitWeb links.
* Returns the name for gitweb links.
*
* @return the name for GitWeb links
* @return the name for gitweb links
*/
public final String getLinkName() {
return "(" + type().name() + ")";
}
/**
* Returns the GitWeb link to a revision.
* Returns the gitweb link to a revision.
*
* @param project the name of the project
* @param commit the commit ID
* @return GitWeb link to a revision
* @return gitweb link to a revision
*/
public final String toRevision(String project, String commit) {
ParameterizedString pattern = new ParameterizedString(type().revision());
@@ -80,21 +80,21 @@ public class GitWebInfo extends JavaScriptObject {
}
/**
* Returns the GitWeb link to a revision.
* Returns the gitweb link to a revision.
*
* @param project the name of the project
* @param ps the patch set
* @return GitWeb link to a revision
* @return gitweb link to a revision
*/
public final String toRevision(Project.NameKey project, PatchSet ps) {
return toRevision(project.get(), ps.getRevision().get());
}
/**
* Returns the GitWeb link to a project.
* Returns the gitweb link to a project.
*
* @param project the project name key
* @return GitWeb link to a project
* @return gitweb link to a project
*/
public final String toProject(Project.NameKey project) {
ParameterizedString pattern = new ParameterizedString(type().project());
@@ -105,10 +105,10 @@ public class GitWebInfo extends JavaScriptObject {
}
/**
* Returns the GitWeb link to a branch.
* Returns the gitweb link to a branch.
*
* @param branch the branch name key
* @return GitWeb link to a branch
* @return gitweb link to a branch
*/
public final String toBranch(Branch.NameKey branch) {
ParameterizedString pattern = new ParameterizedString(type().branch());
@@ -120,12 +120,12 @@ public class GitWebInfo extends JavaScriptObject {
}
/**
* Returns the GitWeb link to a file.
* Returns the gitweb link to a file.
*
* @param project the branch name key
* @param commit the commit ID
* @param file the path of the file
* @return GitWeb link to a file
* @return gitweb link to a file
*/
public final String toFile(String project, String commit, String file) {
Map<String, String> p = new HashMap<>();
@@ -140,11 +140,11 @@ public class GitWebInfo extends JavaScriptObject {
}
/**
* Returns the GitWeb link to a file history.
* Returns the gitweb link to a file history.
*
* @param branch the branch name key
* @param file the path of the file
* @return GitWeb link to a file history
* @return gitweb link to a file history
*/
public final String toFileHistory(Branch.NameKey branch, String file) {
ParameterizedString pattern = new ParameterizedString(type().fileHistory());
@@ -164,6 +164,6 @@ public class GitWebInfo extends JavaScriptObject {
}
}
protected GitWebInfo() {
protected GitwebInfo() {
}
}

View File

@@ -16,7 +16,7 @@ package com.google.gerrit.client.config;
import com.google.gwt.core.client.JavaScriptObject;
public class GitWebTypeInfo extends JavaScriptObject {
public class GitwebTypeInfo extends JavaScriptObject {
/**
* Replace the standard path separator ('/') in a branch name or project
* name with a custom path separator configured by the property
@@ -43,6 +43,6 @@ public class GitWebTypeInfo extends JavaScriptObject {
public final native boolean linkDrafts() /*-{ return this.link_drafts || false; }-*/;
public final native boolean urlEncode() /*-{ return this.url_encode || false; }-*/;
protected GitWebTypeInfo() {
protected GitwebTypeInfo() {
}
}

View File

@@ -22,7 +22,7 @@ public class ServerInfo extends JavaScriptObject {
public final native ContactStoreInfo contactStore() /*-{ return this.contact_store; }-*/;
public final native DownloadInfo download() /*-{ return this.download; }-*/;
public final native GerritInfo gerrit() /*-{ return this.gerrit; }-*/;
public final native GitWebInfo gitWeb() /*-{ return this.git_web; }-*/;
public final native GitwebInfo gitweb() /*-{ return this.gitweb; }-*/;
public final native SshdInfo sshd() /*-{ return this.sshd; }-*/;
public final native SuggestInfo suggest() /*-{ return this.suggest; }-*/;
public final native UserConfigInfo user() /*-{ return this.user; }-*/;

View File

@@ -22,7 +22,7 @@ import com.google.gerrit.client.changes.ChangeInfo;
import com.google.gerrit.client.changes.ChangeInfo.RevisionInfo;
import com.google.gerrit.client.changes.ReviewInfo;
import com.google.gerrit.client.changes.Util;
import com.google.gerrit.client.config.GitWebInfo;
import com.google.gerrit.client.config.GitwebInfo;
import com.google.gerrit.client.diff.DiffInfo.Region;
import com.google.gerrit.client.patches.PatchUtil;
import com.google.gerrit.client.rpc.CallbackGroup;
@@ -115,8 +115,8 @@ public class Header extends Composite {
return b.append(Util.C.commitMessage());
}
GitWebInfo gw = (project != null && commit != null)
? Gerrit.info().gitWeb() : null;
GitwebInfo gw = (project != null && commit != null)
? Gerrit.info().gitweb() : null;
int s = path.lastIndexOf('/') + 1;
if (gw != null && s > 0) {
String base = path.substring(0, s - 1);
@@ -193,7 +193,7 @@ public class Header extends Composite {
}
void setChangeInfo(ChangeInfo info) {
GitWebInfo gw = Gerrit.info().gitWeb();
GitwebInfo gw = Gerrit.info().gitweb();
if (gw != null) {
for (RevisionInfo rev : Natives.asList(info.revisions().values())) {
if (patchSetId.getId().equals(rev.id())) {

View File

@@ -23,14 +23,14 @@ import com.google.gerrit.httpd.auth.become.BecomeAnyAccountModule;
import com.google.gerrit.httpd.auth.container.HttpAuthModule;
import com.google.gerrit.httpd.auth.container.HttpsClientSslCertModule;
import com.google.gerrit.httpd.auth.ldap.LdapAuthModule;
import com.google.gerrit.httpd.gitweb.GitWebModule;
import com.google.gerrit.httpd.gitweb.GitwebModule;
import com.google.gerrit.httpd.rpc.UiRpcModule;
import com.google.gerrit.lifecycle.LifecycleModule;
import com.google.gerrit.server.RemotePeer;
import com.google.gerrit.server.config.AuthConfig;
import com.google.gerrit.server.config.CanonicalWebUrl;
import com.google.gerrit.server.config.GerritRequestModule;
import com.google.gerrit.server.config.GitWebCgiConfig;
import com.google.gerrit.server.config.GitwebCgiConfig;
import com.google.gerrit.server.git.AsyncReceiveCommits;
import com.google.gerrit.server.util.GuiceRequestScopePropagator;
import com.google.gerrit.server.util.RequestScopePropagator;
@@ -43,18 +43,18 @@ import java.net.SocketAddress;
public class WebModule extends LifecycleModule {
private final AuthConfig authConfig;
private final boolean wantSSL;
private final GitWebCgiConfig gitWebCgiConfig;
private final GitwebCgiConfig gitwebCgiConfig;
private final GerritOptions options;
@Inject
WebModule(AuthConfig authConfig,
@CanonicalWebUrl @Nullable String canonicalUrl,
GerritOptions options,
GitWebCgiConfig gitWebCgiConfig) {
GitwebCgiConfig gitwebCgiConfig) {
this.authConfig = authConfig;
this.wantSSL = canonicalUrl != null && canonicalUrl.startsWith("https:");
this.options = options;
this.gitWebCgiConfig = gitWebCgiConfig;
this.gitwebCgiConfig = gitwebCgiConfig;
}
@Override
@@ -75,8 +75,8 @@ public class WebModule extends LifecycleModule {
install(new GerritRequestModule());
install(new GitOverHttpServlet.Module(options.enableMasterFeatures()));
if (gitWebCgiConfig.getGitwebCgi() != null) {
install(new GitWebModule());
if (gitwebCgiConfig.getGitwebCgi() != null) {
install(new GitwebModule());
}
DynamicSet.setOf(binder(), WebUiPlugin.class);

View File

@@ -17,7 +17,7 @@ package com.google.gerrit.httpd.gitweb;
import static com.google.gerrit.common.FileUtil.lastModified;
import com.google.common.io.ByteStreams;
import com.google.gerrit.server.config.GitWebCgiConfig;
import com.google.gerrit.server.config.GitwebCgiConfig;
import com.google.gwtexpui.server.CacheHeaders;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -41,7 +41,7 @@ class GitLogoServlet extends HttpServlet {
private final byte[] raw;
@Inject
GitLogoServlet(GitWebCgiConfig cfg) throws IOException {
GitLogoServlet(GitwebCgiConfig cfg) throws IOException {
byte[] png;
Path src = cfg.getGitLogoPng();
if (src != null) {

View File

@@ -17,7 +17,7 @@ package com.google.gerrit.httpd.gitweb;
import static com.google.gerrit.common.FileUtil.lastModified;
import com.google.gerrit.httpd.HtmlDomUtil;
import com.google.gerrit.server.config.GitWebCgiConfig;
import com.google.gerrit.server.config.GitwebCgiConfig;
import com.google.gerrit.server.config.SitePaths;
import com.google.gwtexpui.server.CacheHeaders;
import com.google.gwtjsonrpc.server.RPCServletUtils;
@@ -34,9 +34,9 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
abstract class GitWebCssServlet extends HttpServlet {
abstract class GitwebCssServlet extends HttpServlet {
@Singleton
static class Site extends GitWebCssServlet {
static class Site extends GitwebCssServlet {
@Inject
Site(SitePaths paths) throws IOException {
super(paths.site_css);
@@ -44,9 +44,9 @@ abstract class GitWebCssServlet extends HttpServlet {
}
@Singleton
static class Default extends GitWebCssServlet {
static class Default extends GitwebCssServlet {
@Inject
Default(GitWebCgiConfig gwcc) throws IOException {
Default(GitwebCgiConfig gwcc) throws IOException {
super(gwcc.getGitwebCss());
}
}
@@ -57,7 +57,7 @@ abstract class GitWebCssServlet extends HttpServlet {
private final byte[] raw_css;
private final byte[] gz_css;
GitWebCssServlet(final Path src)
GitwebCssServlet(final Path src)
throws IOException {
if (src != null) {
final Path dir = src.getParent();

View File

@@ -17,7 +17,7 @@ package com.google.gerrit.httpd.gitweb;
import static com.google.gerrit.common.FileUtil.lastModified;
import com.google.common.io.ByteStreams;
import com.google.gerrit.server.config.GitWebCgiConfig;
import com.google.gerrit.server.config.GitwebCgiConfig;
import com.google.gwtexpui.server.CacheHeaders;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -36,14 +36,14 @@ import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
@Singleton
class GitWebJavaScriptServlet extends HttpServlet {
class GitwebJavaScriptServlet extends HttpServlet {
private final long modified;
private final byte[] raw;
@Inject
GitWebJavaScriptServlet(GitWebCgiConfig gitWebCgiConfig) throws IOException {
GitwebJavaScriptServlet(GitwebCgiConfig gitwebCgiConfig) throws IOException {
byte[] png;
Path src = gitWebCgiConfig.getGitwebJs();
Path src = gitwebCgiConfig.getGitwebJs();
if (src != null) {
try (InputStream in = Files.newInputStream(src)) {
png = ByteStreams.toByteArray(in);

View File

@@ -16,13 +16,13 @@ package com.google.gerrit.httpd.gitweb;
import com.google.inject.servlet.ServletModule;
public class GitWebModule extends ServletModule {
public class GitwebModule extends ServletModule {
@Override
protected void configureServlets() {
serve("/gitweb").with(GitWebServlet.class);
serve("/gitweb").with(GitwebServlet.class);
serve("/gitweb-logo.png").with(GitLogoServlet.class);
serve("/gitweb.js").with(GitWebJavaScriptServlet.class);
serve("/gitweb-default.css").with(GitWebCssServlet.Default.class);
serve("/gitweb-site.css").with(GitWebCssServlet.Site.class);
serve("/gitweb.js").with(GitwebJavaScriptServlet.class);
serve("/gitweb-default.css").with(GitwebCssServlet.Default.class);
serve("/gitweb-site.css").with(GitwebCssServlet.Site.class);
}
}

View File

@@ -38,8 +38,8 @@ import com.google.gerrit.server.AnonymousUser;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.config.GitWebCgiConfig;
import com.google.gerrit.server.config.GitWebConfig;
import com.google.gerrit.server.config.GitwebCgiConfig;
import com.google.gerrit.server.config.GitwebConfig;
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.git.LocalDiskRepositoryManager;
import com.google.gerrit.server.project.NoSuchProjectException;
@@ -82,9 +82,9 @@ import javax.servlet.http.HttpServletResponse;
/** Invokes {@code gitweb.cgi} for the project given in {@code p}. */
@SuppressWarnings("serial")
@Singleton
class GitWebServlet extends HttpServlet {
class GitwebServlet extends HttpServlet {
private static final Logger log =
LoggerFactory.getLogger(GitWebServlet.class);
LoggerFactory.getLogger(GitwebServlet.class);
private static final String PROJECT_LIST_ACTION = "project_list";
@@ -99,24 +99,24 @@ class GitWebServlet extends HttpServlet {
private final EnvList _env;
@Inject
GitWebServlet(LocalDiskRepositoryManager repoManager,
GitwebServlet(LocalDiskRepositoryManager repoManager,
ProjectControl.Factory projectControl,
Provider<AnonymousUser> anonymousUserProvider,
Provider<CurrentUser> userProvider,
SitePaths site,
@GerritServerConfig Config cfg,
SshInfo sshInfo,
GitWebConfig gitWebConfig,
GitWebCgiConfig gitWebCgiConfig)
GitwebConfig gitwebConfig,
GitwebCgiConfig gitwebCgiConfig)
throws IOException {
this.repoManager = repoManager;
this.projectControl = projectControl;
this.anonymousUserProvider = anonymousUserProvider;
this.userProvider = userProvider;
this.gitwebCgi = gitWebCgiConfig.getGitwebCgi();
this.gitwebCgi = gitwebCgiConfig.getGitwebCgi();
this.deniedActions = new HashSet<>();
final String url = gitWebConfig.getUrl();
final String url = gitwebConfig.getUrl();
if ((url != null) && (!url.equals("gitweb"))) {
URI uri = null;
try {
@@ -269,7 +269,7 @@ class GitWebServlet extends HttpServlet {
}
// Link back to Gerrit (when possible, to matching review record).
// Supported Gitweb's hash values are:
// Supported gitweb's hash values are:
// - (missing),
// - HEAD,
// - refs/heads/<branch>,
@@ -579,7 +579,7 @@ class GitWebServlet extends HttpServlet {
env.set("REMOTE_USER", remoteUser);
// Override CGI settings using alternative URI provided by gitweb.url.
// This is required to trick Gitweb into thinking that it's served under
// This is required to trick gitweb into thinking that it's served under
// different URL. Setting just $my_uri on the perl's side isn't enough,
// because few actions (atom, blobdiff_plain, commitdiff_plain) rely on
// URL returned by $cgi->self_url().
@@ -644,7 +644,7 @@ class GitWebServlet extends HttpServlet {
log.debug("Unexpected error copying input to CGI", e);
}
}
}, "GitWeb-InputFeeder").start();
}, "Gitweb-InputFeeder").start();
}
private void copyStderrToLog(final InputStream in) {
@@ -666,7 +666,7 @@ class GitWebServlet extends HttpServlet {
log.debug("Unexpected error copying stderr from CGI", e);
}
}
}, "GitWeb-ErrorLogger").start();
}, "Gitweb-ErrorLogger").start();
}
private static Enumeration<String> enumerateHeaderNames(HttpServletRequest req) {

View File

@@ -216,7 +216,7 @@ public class GerritGlobalModule extends FactoryModule {
bind(ToolsCatalog.class);
bind(EventFactory.class);
bind(TransferConfig.class);
bind(GitWebConfig.class);
bind(GitwebConfig.class);
bind(GcConfig.class);

View File

@@ -18,7 +18,7 @@ import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.gerrit.common.data.GitWebType;
import com.google.gerrit.common.data.GitwebType;
import com.google.gerrit.extensions.config.CloneCommand;
import com.google.gerrit.extensions.config.DownloadCommand;
import com.google.gerrit.extensions.config.DownloadScheme;
@@ -51,7 +51,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
private final AllProjectsName allProjectsName;
private final AllUsersName allUsersName;
private final String anonymousCowardName;
private final GitWebConfig gitWebConfig;
private final GitwebConfig gitwebConfig;
@Inject
public GetServerInfo(
@@ -65,7 +65,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
AllProjectsName allProjectsName,
AllUsersName allUsersName,
@AnonymousCowardName String anonymousCowardName,
GitWebConfig gitWebConfig) {
GitwebConfig gitwebConfig) {
this.config = config;
this.authConfig = authConfig;
this.realm = realm;
@@ -76,7 +76,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
this.allProjectsName = allProjectsName;
this.allUsersName = allUsersName;
this.anonymousCowardName = anonymousCowardName;
this.gitWebConfig = gitWebConfig;
this.gitwebConfig = gitwebConfig;
}
@Override
@@ -89,7 +89,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
getDownloadInfo(downloadSchemes, downloadCommands, cloneCommands,
archiveFormats);
info.gerrit = getGerritInfo(config, allProjectsName, allUsersName);
info.gitWeb = getGitWebInfo(gitWebConfig);
info.gitweb = getGitwebInfo(gitwebConfig);
info.sshd = getSshdInfo(config);
info.suggest = getSuggestInfo(config);
info.user = getUserInfo(anonymousCowardName);
@@ -227,14 +227,14 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
return info;
}
private GitWebInfo getGitWebInfo(GitWebConfig cfg) {
if (cfg.getUrl() == null || cfg.getGitWebType() == null) {
private GitwebInfo getGitwebInfo(GitwebConfig cfg) {
if (cfg.getUrl() == null || cfg.getGitwebType() == null) {
return null;
}
GitWebInfo info = new GitWebInfo();
GitwebInfo info = new GitwebInfo();
info.url = cfg.getUrl();
info.type = cfg.getGitWebType();
info.type = cfg.getGitwebType();
return info;
}
@@ -274,7 +274,7 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
public ContactStoreInfo contactStore;
public DownloadInfo download;
public GerritInfo gerrit;
public GitWebInfo gitWeb;
public GitwebInfo gitweb;
public SshdInfo sshd;
public SuggestInfo suggest;
public UserConfigInfo user;
@@ -326,9 +326,9 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
public String reportBugText;
}
public static class GitWebInfo {
public static class GitwebInfo {
public String url;
public GitWebType type;
public GitwebType type;
}
public static class SshdInfo {

View File

@@ -28,12 +28,12 @@ import java.nio.file.Path;
import java.nio.file.Paths;
@Singleton
public class GitWebCgiConfig {
public class GitwebCgiConfig {
private static final Logger log =
LoggerFactory.getLogger(GitWebCgiConfig.class);
LoggerFactory.getLogger(GitwebCgiConfig.class);
public GitWebCgiConfig disabled() {
return new GitWebCgiConfig();
public GitwebCgiConfig disabled() {
return new GitwebCgiConfig();
}
private final Path cgi;
@@ -42,8 +42,8 @@ public class GitWebCgiConfig {
private final Path logoPng;
@Inject
GitWebCgiConfig(SitePaths sitePaths, @GerritServerConfig Config cfg) {
if (GitWebConfig.isDisabled(cfg)) {
GitwebCgiConfig(SitePaths sitePaths, @GerritServerConfig Config cfg) {
if (GitwebConfig.isDisabled(cfg)) {
cgi = null;
css = null;
js = null;
@@ -108,7 +108,7 @@ public class GitWebCgiConfig {
this.logoPng = logo;
}
private GitWebCgiConfig() {
private GitwebCgiConfig() {
this.cgi = null;
this.css = null;
this.js = null;

View File

@@ -19,15 +19,15 @@ import static com.google.common.base.Strings.isNullOrEmpty;
import static com.google.common.base.Strings.nullToEmpty;
import com.google.common.base.Strings;
import com.google.gerrit.common.data.GitWebType;
import com.google.gerrit.common.data.GitwebType;
import com.google.inject.Inject;
import org.eclipse.jgit.lib.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class GitWebConfig {
private static final Logger log = LoggerFactory.getLogger(GitWebConfig.class);
public class GitwebConfig {
private static final Logger log = LoggerFactory.getLogger(GitwebConfig.class);
public static boolean isDisabled(Config cfg) {
return isEmptyString(cfg, "gitweb", null, "url")
@@ -43,17 +43,17 @@ public class GitWebConfig {
}
/**
* Get a GitWebType based on the given config.
* Get a GitwebType based on the given config.
*
* @param cfg Gerrit config.
* @return GitWebType from the given name, else null if not found.
* @return GitwebType from the given name, else null if not found.
*/
public static GitWebType typeFromConfig(Config cfg) {
GitWebType defaultType = defaultType(cfg.getString("gitweb", null, "type"));
public static GitwebType typeFromConfig(Config cfg) {
GitwebType defaultType = defaultType(cfg.getString("gitweb", null, "type"));
if (defaultType == null) {
return null;
}
GitWebType type = new GitWebType();
GitwebType type = new GitwebType();
type.setLinkName(firstNonNull(
cfg.getString("gitweb", null, "linkname"),
@@ -100,8 +100,8 @@ public class GitWebConfig {
return type;
}
private static GitWebType defaultType(String typeName) {
GitWebType type = new GitWebType();
private static GitwebType defaultType(String typeName) {
GitwebType type = new GitwebType();
switch (nullToEmpty(typeName)) {
case "":
case "gitweb":
@@ -140,10 +140,10 @@ public class GitWebConfig {
}
private final String url;
private final GitWebType type;
private final GitwebType type;
@Inject
GitWebConfig(GitWebCgiConfig cgiConfig, @GerritServerConfig Config cfg) {
GitwebConfig(GitwebCgiConfig cgiConfig, @GerritServerConfig Config cfg) {
if (isDisabled(cfg)) {
type = null;
url = null;
@@ -151,7 +151,7 @@ public class GitWebConfig {
}
String cfgUrl = cfg.getString("gitweb", null, "url");
GitWebType type = typeFromConfig(cfg);
GitwebType type = typeFromConfig(cfg);
if (type == null) {
this.type = null;
url = null;
@@ -186,8 +186,8 @@ public class GitWebConfig {
}
}
/** @return GitWebType for gitweb viewer. */
public GitWebType getGitWebType() {
/** @return GitwebType for gitweb viewer. */
public GitwebType getGitwebType() {
return type;
}

View File

@@ -14,14 +14,12 @@
package com.google.gerrit.server.config;
import com.google.gerrit.server.config.GitWebConfig;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class GitWebConfigTest {
public class GitwebConfigTest {
private static final String VALID_CHARACTERS = "*()";
private static final String SOME_INVALID_CHARACTERS = "09AZaz$-_.+!',";
@@ -29,14 +27,14 @@ public class GitWebConfigTest {
@Test
public void testValidPathSeparator() {
for(char c : VALID_CHARACTERS.toCharArray()) {
assertTrue("valid character rejected: " + c, GitWebConfig.isValidPathSeparator(c));
assertTrue("valid character rejected: " + c, GitwebConfig.isValidPathSeparator(c));
}
}
@Test
public void testInalidPathSeparator() {
for(char c : SOME_INVALID_CHARACTERS.toCharArray()) {
assertFalse("invalid character accepted: " + c, GitWebConfig.isValidPathSeparator(c));
assertFalse("invalid character accepted: " + c, GitwebConfig.isValidPathSeparator(c));
}
}
}