Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/controllers/git-tab-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 === ''),
};
}
Expand Down
5 changes: 3 additions & 2 deletions styles/git-identity.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
23 changes: 23 additions & 0 deletions test/controllers/git-tab-controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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, {
Expand Down