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

Commit aa5de1d

Browse files
authored
Merge pull request #2437 from atom/only-show-identity-on-present
Only show identity on present repositories
2 parents 86be963 + f4a7aa2 commit aa5de1d

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

lib/controllers/git-tab-controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default class GitTabController extends React.Component {
9797
static getDerivedStateFromProps(props, state) {
9898
return {
9999
editingIdentity: state.editingIdentity ||
100-
(!props.fetchInProgress && !props.repository.showGitTabLoading() && !props.repositoryDrift) &&
100+
(!props.fetchInProgress && props.repository.isPresent() && !props.repositoryDrift) &&
101101
(props.username === '' || props.email === ''),
102102
};
103103
}

styles/git-identity.less

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717

1818
&-text {
1919
width: 90%;
20-
margin-bottom: @component-padding * 3;
20+
margin-bottom: @component-padding * 2;
2121

2222
.github-AtomTextEditor-container {
23-
margin: @component-padding/2 0;
23+
margin: @component-padding 0;
24+
height: inherit;
2425
}
2526
}
2627

test/controllers/git-tab-controller.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from 'path';
33
import React from 'react';
44
import {mount} from 'enzyme';
55
import dedent from 'dedent-js';
6+
import temp from 'temp';
67

78
import GitTabController from '../../lib/controllers/git-tab-controller';
89
import {gitTabControllerProps} from '../fixtures/props/git-tab-props';
@@ -119,6 +120,28 @@ describe('GitTabController', function() {
119120
assert.isFalse(wrapper.find('GitTabView').prop('editingIdentity'));
120121
});
121122

123+
it('is not shown for an absent repository', async function() {
124+
const wrapper = mount(await buildApp(Repository.absent(), {
125+
fetchInProgress: false,
126+
username: '',
127+
email: '',
128+
}));
129+
130+
assert.isFalse(wrapper.find('GitTabView').prop('editingIdentity'));
131+
});
132+
133+
it('is not shown for an empty repository', async function() {
134+
const nongit = temp.mkdirSync();
135+
const repository = await buildRepository(nongit);
136+
const wrapper = mount(await buildApp(repository, {
137+
fetchInProgress: false,
138+
username: '',
139+
email: '',
140+
}));
141+
142+
assert.isFalse(wrapper.find('GitTabView').prop('editingIdentity'));
143+
});
144+
122145
it('is shown by default when username or email are empty', async function() {
123146
const repository = await buildRepository(await cloneRepository('three-files'));
124147
const wrapper = mount(await buildApp(repository, {

0 commit comments

Comments
 (0)