From 762764b6360d97bb4ad35419c97f9d9c73fcf264 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 6f7d247df81..071cdd8e17a 100644 --- a/app/src/ui/add-repository/add-existing-repository.tsx +++ b/app/src/ui/add-repository/add-existing-repository.tsx @@ -16,6 +16,7 @@ import { showOpenDialog } from '../main-process-proxy' import { Ref } from '../lib/ref' import { InputError } from '../lib/input-description/input-error' import { IAccessibleMessage } from '../../models/accessible-message' +import { isGitRepository } from './create-repository' interface IAddExistingRepositoryProps { readonly dispatcher: Dispatcher @@ -278,9 +279,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 () => {