diff --git a/lib/controllers/git-tab-controller.js b/lib/controllers/git-tab-controller.js index 1045eb6f8d..60cf360cd3 100644 --- a/lib/controllers/git-tab-controller.js +++ b/lib/controllers/git-tab-controller.js @@ -97,7 +97,7 @@ export default class GitTabController extends React.Component { static getDerivedStateFromProps(props, state) { return { editingIdentity: state.editingIdentity || - (!props.fetchInProgress && !props.repository.showGitTabLoading() && !props.repositoryDrift) && + (!props.fetchInProgress && props.repository.isPresent() && !props.repositoryDrift) && (props.username === '' || props.email === ''), }; } diff --git a/styles/git-identity.less b/styles/git-identity.less index c37375c6d6..9de8483119 100644 --- a/styles/git-identity.less +++ b/styles/git-identity.less @@ -17,10 +17,11 @@ &-text { width: 90%; - margin-bottom: @component-padding * 3; + margin-bottom: @component-padding * 2; .github-AtomTextEditor-container { - margin: @component-padding/2 0; + margin: @component-padding 0; + height: inherit; } } diff --git a/test/controllers/git-tab-controller.test.js b/test/controllers/git-tab-controller.test.js index 7e60629b6a..d04a79c832 100644 --- a/test/controllers/git-tab-controller.test.js +++ b/test/controllers/git-tab-controller.test.js @@ -3,6 +3,7 @@ import path from 'path'; import React from 'react'; import {mount} from 'enzyme'; import dedent from 'dedent-js'; +import temp from 'temp'; import GitTabController from '../../lib/controllers/git-tab-controller'; import {gitTabControllerProps} from '../fixtures/props/git-tab-props'; @@ -119,6 +120,28 @@ describe('GitTabController', function() { assert.isFalse(wrapper.find('GitTabView').prop('editingIdentity')); }); + it('is not shown for an absent repository', async function() { + const wrapper = mount(await buildApp(Repository.absent(), { + fetchInProgress: false, + username: '', + email: '', + })); + + assert.isFalse(wrapper.find('GitTabView').prop('editingIdentity')); + }); + + it('is not shown for an empty repository', async function() { + const nongit = temp.mkdirSync(); + const repository = await buildRepository(nongit); + const wrapper = mount(await buildApp(repository, { + fetchInProgress: false, + username: '', + email: '', + })); + + assert.isFalse(wrapper.find('GitTabView').prop('editingIdentity')); + }); + it('is shown by default when username or email are empty', async function() { const repository = await buildRepository(await cloneRepository('three-files')); const wrapper = mount(await buildApp(repository, {