Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit f466251

Browse files
committed
Don't set username or email when unchanged
1 parent ba5d258 commit f466251

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/controllers/git-tab-controller.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,19 @@ export default class GitTabController extends React.Component {
371371

372372
closeIdentityEditor = () => this.setState({editingIdentity: false})
373373

374-
setUsername = () => this.props.repository.setConfig('user.name', this.usernameBuffer.getText(), {global: true})
374+
setUsername = () => {
375+
const newUsername = this.usernameBuffer.getText();
376+
if (newUsername !== this.props.username) {
377+
this.props.repository.setConfig('user.name', newUsername, {global: true});
378+
}
379+
}
375380

376-
setEmail = () => this.props.repository.setConfig('user.email', this.emailBuffer.getText(), {global: true})
381+
setEmail = () => {
382+
const newEmail = this.emailBuffer.getText();
383+
if (newEmail !== this.props.email) {
384+
this.props.repository.setConfig('user.email', newEmail, {global: true});
385+
}
386+
}
377387

378388
restoreFocus() {
379389
this.refView.map(view => view.setFocus(this.lastFocus));

0 commit comments

Comments
 (0)