Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

add await to the async isValidGitDirectory #22578

Merged
merged 3 commits into from
Jul 28, 2021
Merged

add await to the async isValidGitDirectory #22578

merged 3 commits into from
Jul 28, 2021

Conversation

icecream17
Copy link
Contributor

@icecream17 icecream17 commented Jun 11, 2021

Requirements for Contributing a Bug Fix

Identify the Bug

Fixes #22577

Description of the Change

Pretty self explanatory

isValidGitDirectory is an async function, and so actually returns a Promise which is always truthy

Alternate Designs

N/A

Possible Drawbacks

N/A

Verification Process

N/A (Hopefully)

Release Notes

The findGitDirectory function now checks if the directory is valid

Since isValidGitDirectory is async, it actually returns Promise<boolean> which is always truthy

That's probably not what the code meant
@icecream17
Copy link
Contributor Author

There might also be a bug on line 144 with non-awaited promises, but lgtm.com doesn't say anything about it, so maybe it's intentional??

@UziTech
Copy link
Contributor

UziTech commented Jun 21, 2021

Looks like line 144 is just returning the promise instead of returning the awaited value.

It shouldn't make a difference but I feel like it should await the last call just to be consistent.

See comment #22578 (comment)

What I didn't realize was that line 144 was in an async return. So this commit shouldn't actually change any functionality.
Nevertheless, await it for consistency.
@darangi darangi merged commit ad27d84 into atom:master Jul 28, 2021
@icecream17 icecream17 deleted the patch-1 branch August 13, 2021 12:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

findGitDirectory can return an invalid git directory
3 participants