Skip to content

Commit 7dfc4e7

Browse files
author
Stephan Dilly
committed
Fix 740 gpgsign warning (#741)
* error if gpgsign=true
1 parent 22d622f commit 7dfc4e7

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- smarter log timestamps ([#682](https://github.com/extrawurst/gitui/issues/682))
2626
- create-branch popup aligned with rename-branch [[@bruceCoelho](https://github.com/bruceCoelho)] ([#679](https://github.com/extrawurst/gitui/issues/679))
2727
- smart focus change after staging all files ([#706](https://github.com/extrawurst/gitui/issues/706))
28+
- do not allow to commit when `gpgsign` enabled ([#740](https://github.com/extrawurst/gitui/issues/740))
2829

2930
## Fixed
3031
- selected-tab color broken in light theme [[@Cottser](https://github.com/Cottser)] ([#719](https://github.com/extrawurst/gitui/issues/719))

src/components/commit.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use super::{
66
use crate::{
77
keys::SharedKeyConfig,
88
queue::{InternalEvent, NeedsUpdate, Queue},
9-
strings,
9+
strings, try_or_popup,
1010
ui::style::SharedTheme,
1111
};
1212
use anyhow::Result;
@@ -106,7 +106,11 @@ impl Component for CommitComponent {
106106

107107
if let Event::Key(e) = ev {
108108
if e == self.key_config.enter && self.can_commit() {
109-
self.commit()?;
109+
try_or_popup!(
110+
self,
111+
"commit error:",
112+
self.commit()
113+
);
110114
} else if e == self.key_config.commit_amend
111115
&& self.can_amend()
112116
{
@@ -293,6 +297,16 @@ impl CommitComponent {
293297
}
294298

295299
fn commit(&mut self) -> Result<()> {
300+
let gpgsign = get_config_string(CWD, "commit.gpgsign")
301+
.ok()
302+
.flatten()
303+
.and_then(|path| path.parse::<bool>().ok())
304+
.unwrap_or_default();
305+
306+
if gpgsign {
307+
anyhow::bail!("config commit.gpgsign=true detected.\ngpg signing not supported.\ndeactivate in your repo/gitconfig to be able to commit without signing.");
308+
}
309+
296310
let msg = self.input.get_text().clone();
297311
self.input.clear();
298312
self.commit_with_msg(msg)

0 commit comments

Comments
 (0)