Change direct access to Common.UserConfig to a getter

This will allow us to turn the field into an atomic.Value for safe concurrent
access.
This commit is contained in:
Stefan Haller 2024-08-01 12:20:05 +02:00
parent f114321322
commit f98b57aa5e
70 changed files with 204 additions and 193 deletions

View file

@ -357,8 +357,8 @@ func (self *LocalCommitsController) reword(commit *models.Commit) error {
if err != nil {
return err
}
if self.c.UserConfig.Git.Commit.AutoWrapCommitMessage {
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig.Git.Commit.AutoWrapWidth)
if self.c.UserConfig().Git.Commit.AutoWrapCommitMessage {
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig().Git.Commit.AutoWrapWidth)
}
return self.c.Helpers().Commits.OpenCommitMessagePanel(
&helpers.OpenCommitMessagePanelOpts{
@ -438,7 +438,7 @@ func (self *LocalCommitsController) doRewordEditor() error {
}
func (self *LocalCommitsController) rewordEditor(commit *models.Commit) error {
if self.c.UserConfig.Gui.SkipRewordInEditorWarning {
if self.c.UserConfig().Gui.SkipRewordInEditorWarning {
return self.doRewordEditor()
} else {
return self.c.Confirm(types.ConfirmOpts{
@ -564,7 +564,7 @@ func (self *LocalCommitsController) findCommitForQuickStartInteractiveRebase() (
if !ok || index == 0 {
errorMsg := utils.ResolvePlaceholderString(self.c.Tr.CannotQuickStartInteractiveRebase, map[string]string{
"editKey": keybindings.Label(self.c.UserConfig.Keybinding.Universal.Edit),
"editKey": keybindings.Label(self.c.UserConfig().Keybinding.Universal.Edit),
})
return nil, errors.New(errorMsg)
@ -905,8 +905,8 @@ func (self *LocalCommitsController) createAmendCommit(commit *models.Commit, inc
if err != nil {
return err
}
if self.c.UserConfig.Git.Commit.AutoWrapCommitMessage {
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig.Git.Commit.AutoWrapWidth)
if self.c.UserConfig().Git.Commit.AutoWrapCommitMessage {
commitMessage = helpers.TryRemoveHardLineBreaks(commitMessage, self.c.UserConfig().Git.Commit.AutoWrapWidth)
}
originalSubject, _, _ := strings.Cut(commitMessage, "\n")
return self.c.Helpers().Commits.OpenCommitMessagePanel(