mirror of
https://github.com/silvanocerza/github-gitless-sync.git
synced 2026-07-22 12:10:28 +00:00
Make log conflict auto-resolution configurable
This commit is contained in:
parent
80f92ce17d
commit
bcf3369667
3 changed files with 24 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ export interface GitHubSyncSettings {
|
|||
syncOnStartup: boolean;
|
||||
syncConfigDir: boolean;
|
||||
conflictHandling: "overwriteLocal" | "ask" | "overwriteRemote";
|
||||
autoResolveLogConflicts: boolean;
|
||||
conflictViewMode: "default" | "unified" | "split";
|
||||
showStatusBarItem: boolean;
|
||||
showSyncRibbonButton: boolean;
|
||||
|
|
@ -27,6 +28,7 @@ export const DEFAULT_SETTINGS: GitHubSyncSettings = {
|
|||
syncOnStartup: false,
|
||||
syncConfigDir: false,
|
||||
conflictHandling: "ask",
|
||||
autoResolveLogConflicts: true,
|
||||
conflictViewMode: "default",
|
||||
showStatusBarItem: true,
|
||||
showSyncRibbonButton: true,
|
||||
|
|
|
|||
|
|
@ -189,6 +189,20 @@ export default class GitHubSyncSettingsTab extends PluginSettingTab {
|
|||
});
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Automatically resolve conflits in logs")
|
||||
.setDesc(
|
||||
"Automatically resolves conflits in this plugin's logs prioritizing the local file",
|
||||
)
|
||||
.addToggle((toggle) => {
|
||||
toggle
|
||||
.setValue(this.plugin.settings.autoResolveLogConflicts)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.autoResolveLogConflicts = value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(containerEl).setName("Interface").setHeading();
|
||||
|
||||
new Setting(containerEl)
|
||||
|
|
|
|||
|
|
@ -452,8 +452,11 @@ export default class SyncManager {
|
|||
// commit the sync.
|
||||
let conflictResolutions: ConflictResolution[] = [];
|
||||
|
||||
const logConflictResolutions = conflicts
|
||||
.filter((conflict) => this.isLogFile(conflict.filePath))
|
||||
const autoResolvableLogConflicts = this.settings.autoResolveLogConflicts
|
||||
? conflicts.filter((conflict) => this.isLogFile(conflict.filePath))
|
||||
: [];
|
||||
|
||||
const logConflictResolutions = autoResolvableLogConflicts
|
||||
.map((conflict) => ({
|
||||
filePath: conflict.filePath,
|
||||
content: conflict.localContent,
|
||||
|
|
@ -474,7 +477,9 @@ export default class SyncManager {
|
|||
}
|
||||
|
||||
const remainingConflicts = conflicts.filter(
|
||||
(conflict) => !this.isLogFile(conflict.filePath),
|
||||
(conflict) =>
|
||||
!this.settings.autoResolveLogConflicts ||
|
||||
!this.isLogFile(conflict.filePath),
|
||||
);
|
||||
|
||||
if (remainingConflicts.length > 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue