Fix wrong date/time for commits in refs/meta/config branch
When the refs/meta/config branch is modified using the PutConfig REST endpoint (e.g. when changing the project configuration in the web UI) the commit date/time is wrong. Instead of the actual date/time the date/time of the last Gerrit server start is used. This is because MetaDataUpdate.User which gets the GerritPersonIdent injected is kept as member in the PutConfig singleton and the date/time for commits in the refs/meta/config branch is retrieved from that GerritPersonIdent instance which is only created once when the PutConfig singleton is instantiated. Bug: Issue 3371 Change-Id: I85424db74e8609c8e4117e8db78a80730c29ace1 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -74,7 +74,7 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
|||||||
public Map<String, Map<String, ConfigValue>> pluginConfigValues;
|
public Map<String, Map<String, ConfigValue>> pluginConfigValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final MetaDataUpdate.User metaDataUpdateFactory;
|
private final Provider<MetaDataUpdate.User> metaDataUpdateFactory;
|
||||||
private final ProjectCache projectCache;
|
private final ProjectCache projectCache;
|
||||||
private final GitRepositoryManager gitMgr;
|
private final GitRepositoryManager gitMgr;
|
||||||
private final ProjectState.Factory projectStateFactory;
|
private final ProjectState.Factory projectStateFactory;
|
||||||
@@ -87,7 +87,7 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
|||||||
private final ChangeHooks hooks;
|
private final ChangeHooks hooks;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
PutConfig(MetaDataUpdate.User metaDataUpdateFactory,
|
PutConfig(Provider<MetaDataUpdate.User> metaDataUpdateFactory,
|
||||||
ProjectCache projectCache,
|
ProjectCache projectCache,
|
||||||
GitRepositoryManager gitMgr,
|
GitRepositoryManager gitMgr,
|
||||||
ProjectState.Factory projectStateFactory,
|
ProjectState.Factory projectStateFactory,
|
||||||
@@ -131,7 +131,7 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
|||||||
|
|
||||||
final MetaDataUpdate md;
|
final MetaDataUpdate md;
|
||||||
try {
|
try {
|
||||||
md = metaDataUpdateFactory.create(projectName);
|
md = metaDataUpdateFactory.get().create(projectName);
|
||||||
} catch (RepositoryNotFoundException notFound) {
|
} catch (RepositoryNotFoundException notFound) {
|
||||||
throw new ResourceNotFoundException(projectName.get());
|
throw new ResourceNotFoundException(projectName.get());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user