'Show merge commits' option in repository settings
This commit is contained in:
parent
3a3771db64
commit
808b1dc0c5
@ -78,6 +78,10 @@ public class DefaultCacheCleanupService implements CacheCleanupService {
|
|||||||
clearCacheByName("assets");
|
clearCacheByName("assets");
|
||||||
clearCacheByName("repositorySettings");
|
clearCacheByName("repositorySettings");
|
||||||
break;
|
break;
|
||||||
|
case "3.4.2":
|
||||||
|
log.info("Clearing cache to upgrade from version 3.4.2 to 3.4.3 ...");
|
||||||
|
clearCacheByName("repositorySettings");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
//Do nothing, since cache cleanup is optional.
|
//Do nothing, since cache cleanup is optional.
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,7 @@ public class RepositorySettings implements Serializable {
|
|||||||
private String privateKeyPassword;
|
private String privateKeyPassword;
|
||||||
private String defaultBranch;
|
private String defaultBranch;
|
||||||
private boolean readOnly;
|
private boolean readOnly;
|
||||||
|
private boolean showMergeCommits;
|
||||||
|
|
||||||
public RepositorySettings() {
|
public RepositorySettings() {
|
||||||
}
|
}
|
||||||
@ -46,5 +47,6 @@ public class RepositorySettings implements Serializable {
|
|||||||
this.privateKeyPassword = settings.getPrivateKeyPassword();
|
this.privateKeyPassword = settings.getPrivateKeyPassword();
|
||||||
this.defaultBranch = settings.getDefaultBranch();
|
this.defaultBranch = settings.getDefaultBranch();
|
||||||
this.readOnly = settings.isReadOnly();
|
this.readOnly = settings.isReadOnly();
|
||||||
|
this.showMergeCommits = settings.isShowMergeCommits();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -197,12 +197,7 @@ public class GitRepository {
|
|||||||
LogCommand command = git.log()
|
LogCommand command = git.log()
|
||||||
.add(branchId);
|
.add(branchId);
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(pageLink.getTextSearch())) {
|
command.setRevFilter(new CommitFilter(pageLink.getTextSearch(), settings.isShowMergeCommits()));
|
||||||
command.setRevFilter(new NoMergesAndCommitMessageFilter(pageLink.getTextSearch()));
|
|
||||||
} else {
|
|
||||||
command.setRevFilter(RevFilter.NO_MERGES);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(path)) {
|
if (StringUtils.isNotEmpty(path)) {
|
||||||
command.addPath(path);
|
command.addPath(path);
|
||||||
}
|
}
|
||||||
@ -478,17 +473,20 @@ public class GitRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NoMergesAndCommitMessageFilter extends RevFilter {
|
private static class CommitFilter extends RevFilter {
|
||||||
|
|
||||||
private final String textSearch;
|
private final String textSearch;
|
||||||
|
private final boolean showMergeCommits;
|
||||||
|
|
||||||
NoMergesAndCommitMessageFilter(String textSearch) {
|
CommitFilter(String textSearch, boolean showMergeCommits) {
|
||||||
this.textSearch = textSearch.toLowerCase();
|
this.textSearch = textSearch.toLowerCase();
|
||||||
|
this.showMergeCommits = showMergeCommits;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean include(RevWalk walker, RevCommit c) {
|
public boolean include(RevWalk walker, RevCommit c) {
|
||||||
return c.getParentCount() < 2 && c.getFullMessage().toLowerCase().contains(this.textSearch);
|
return (showMergeCommits || c.getParentCount() < 2) && (StringUtils.isEmpty(textSearch)
|
||||||
|
|| c.getFullMessage().toLowerCase().contains(textSearch));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -501,10 +499,6 @@ public class GitRepository {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "NO_MERGES_AND_COMMIT_MESSAGE";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@ -44,6 +44,11 @@
|
|||||||
<mat-checkbox formControlName="readOnly">
|
<mat-checkbox formControlName="readOnly">
|
||||||
{{ 'admin.repository-read-only' | translate }}
|
{{ 'admin.repository-read-only' | translate }}
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
|
<div>
|
||||||
|
<mat-checkbox formControlName="showMergeCommits">
|
||||||
|
{{ 'admin.show-merge-commits' | translate }}
|
||||||
|
</mat-checkbox>
|
||||||
|
</div>
|
||||||
<fieldset [disabled]="isLoading$ | async" class="fields-group">
|
<fieldset [disabled]="isLoading$ | async" class="fields-group">
|
||||||
<legend class="group-title" translate>admin.authentication-settings</legend>
|
<legend class="group-title" translate>admin.authentication-settings</legend>
|
||||||
<mat-form-field fxFlex class="mat-block">
|
<mat-form-field fxFlex class="mat-block">
|
||||||
|
|||||||
@ -75,6 +75,7 @@ export class RepositorySettingsComponent extends PageComponent implements OnInit
|
|||||||
repositoryUri: [null, [Validators.required]],
|
repositoryUri: [null, [Validators.required]],
|
||||||
defaultBranch: ['main', []],
|
defaultBranch: ['main', []],
|
||||||
readOnly: [false, []],
|
readOnly: [false, []],
|
||||||
|
showMergeCommits: [false, []],
|
||||||
authMethod: [RepositoryAuthMethod.USERNAME_PASSWORD, [Validators.required]],
|
authMethod: [RepositoryAuthMethod.USERNAME_PASSWORD, [Validators.required]],
|
||||||
username: [null, []],
|
username: [null, []],
|
||||||
password: [null, []],
|
password: [null, []],
|
||||||
|
|||||||
@ -418,6 +418,7 @@ export const repositoryAuthMethodTranslationMap = new Map<RepositoryAuthMethod,
|
|||||||
export interface RepositorySettings {
|
export interface RepositorySettings {
|
||||||
repositoryUri: string;
|
repositoryUri: string;
|
||||||
defaultBranch: string;
|
defaultBranch: string;
|
||||||
|
showMergeCommits: boolean;
|
||||||
authMethod: RepositoryAuthMethod;
|
authMethod: RepositoryAuthMethod;
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
|
|||||||
@ -329,6 +329,7 @@
|
|||||||
"repository-url-required": "Repository URL is required.",
|
"repository-url-required": "Repository URL is required.",
|
||||||
"default-branch": "Default branch name",
|
"default-branch": "Default branch name",
|
||||||
"repository-read-only": "Read-only",
|
"repository-read-only": "Read-only",
|
||||||
|
"show-merge-commits": "Show merge commits",
|
||||||
"authentication-settings": "Authentication settings",
|
"authentication-settings": "Authentication settings",
|
||||||
"auth-method": "Authentication method",
|
"auth-method": "Authentication method",
|
||||||
"auth-method-username-password": "Password / access token",
|
"auth-method-username-password": "Password / access token",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user