mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-07 08:55:29 +02:00
Resolved branch revision in Source Extension Point (#1803)
This adds the "resolved revision" of the HEAD (of the current branch, if branches are supported) to the extension point repos.sources.extensions. This "resolved revision" holds the current HEAD revision of the repository (or the selected branch, if branches are supported). This means you can check, whether the release has changed since an extension has been rendered for the first time. Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
This commit is contained in:
@@ -278,8 +278,8 @@ class AbstractGitCommand {
|
||||
logger.debug("pushed changes");
|
||||
}
|
||||
|
||||
Ref getCurrentRevision() throws IOException {
|
||||
return getClone().getRepository().getRefDatabase().findRef("HEAD");
|
||||
ObjectId getCurrentObjectId() throws IOException {
|
||||
return getClone().getRepository().getRefDatabase().findRef("HEAD").getObjectId();
|
||||
}
|
||||
|
||||
private Person determineAuthor(Person author) {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class GitModifyCommand extends AbstractGitCommand implements ModifyComman
|
||||
boolean initialCommit = getClone().getRepository().getRefDatabase().getRefs().isEmpty();
|
||||
|
||||
if (!StringUtils.isEmpty(request.getExpectedRevision())
|
||||
&& !request.getExpectedRevision().equals(getCurrentRevision().getName())) {
|
||||
&& !request.getExpectedRevision().equals(getCurrentObjectId().getName())) {
|
||||
throw new ConcurrentModificationException(ContextEntry.ContextBuilder.entity("Branch", request.getBranch() == null ? "default" : request.getBranch()).in(repository).build());
|
||||
}
|
||||
for (ModifyCommandRequest.PartialRequest r : request.getRequests()) {
|
||||
|
||||
Reference in New Issue
Block a user