Return more project settings from /project/*/config

Include the project state, the default submit type and the max object
size limit into the result of the /projects/*/config REST endpoint.

Change-Id: I5228cf7c11646b74234b8edd49ba1f76c965239d
This commit is contained in:
Edwin Kempin
2013-07-15 10:12:27 +02:00
committed by Edwin Kempin
parent 3660c135be
commit 3c99f596c9
4 changed files with 94 additions and 14 deletions

View File

@@ -94,7 +94,8 @@ final class Receive extends AbstractGitCommand {
final ReceivePack rp = receive.getReceivePack();
rp.setRefLogIdent(currentUser.newRefLogIdent());
rp.setTimeout(config.getTimeout());
rp.setMaxObjectSizeLimit(getMaxObjectSizeLimit());
rp.setMaxObjectSizeLimit(config.getEffectiveMaxObjectSizeLimit(
projectControl.getProjectState()));
try {
receive.advertiseHistory();
rp.receive(in, out, err);
@@ -170,15 +171,4 @@ final class Receive extends AbstractGitCommand {
}
}
}
private long getMaxObjectSizeLimit() {
long global = config.getMaxObjectSizeLimit();
long local = projectControl.getProjectState().getMaxObjectSizeLimit();
if (global > 0 && local > 0) {
return Math.min(global, local);
} else {
// zero means "no limit", in this case the max is more limiting
return Math.max(global, local);
}
}
}