From 7a45520d19fbd07d3ef055f07b577522cd78a252 Mon Sep 17 00:00:00 2001 From: Dan McCarthy Date: Tue, 4 Aug 2020 07:00:32 -0500 Subject: [PATCH] allow tilde character when specifying a local repository (#316) There already exists a function that will convert a tilde path to an absolute path. It was originally used for this purpose, but the functionality was removed during a commit that changed which function was used to validate git repositories. This reinstates that functionality and allows us to type a ~/ tilde path to get our home directories when typing in a path. --- app/src/ui/add-repository/add-existing-repository.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/ui/add-repository/add-existing-repository.tsx b/app/src/ui/add-repository/add-existing-repository.tsx index 1084a2d578d..76a7ba13d7c 100644 --- a/app/src/ui/add-repository/add-existing-repository.tsx +++ b/app/src/ui/add-repository/add-existing-repository.tsx @@ -15,6 +15,7 @@ import { OkCancelButtonGroup } from '../dialog/ok-cancel-button-group' import untildify from 'untildify' import { showOpenDialog } from '../main-process-proxy' import { Ref } from '../lib/ref' +import { isGitRepository } from './create-repository' interface IAddExistingRepositoryProps { readonly dispatcher: Dispatcher @@ -236,9 +237,9 @@ export class AddExistingRepository extends React.Component< } private onPathChanged = async (path: string) => { - if (this.state.path !== path) { - this.updatePath(path) - } + const isRepository = await isGitRepository(this.resolvedPath(path)) + + this.setState({ path, isRepository }) } private showFilePicker = async () => {