Repository navigation
Closed
Labels
integrationsIssues related to editor and shell integrations that ship in Desktoptech-debtIssues and pull requests related to addressing technical debt or improving the codebase
Description
Extracting from #5278
I think I stumbled upon this yesterday when I was testing a Git for Windows installation when I didn't add it PATH. That's this step of the installer:
This check doesn't need to be run when launching Git Bash, because Git Bash will change it's PATH to add where to find Git - so that message is not accurate. There's a bit of work to refactor things in this area so we can conditionally look for Git, but for now you can ignore that warning as Git Bash will continue to work without having Git on your PATH.
An experimental patch that might help with getting started on this:
diff --git a/app/src/lib/dispatcher/dispatcher.ts b/app/src/lib/dispatcher/dispatcher.ts
index caa4b97e1..b5886de49 100644
--- a/app/src/lib/dispatcher/dispatcher.ts
+++ b/app/src/lib/dispatcher/dispatcher.ts
@@ -33,7 +33,6 @@ import { AppMenu, ExecutableMenuItem } from '../../models/app-menu'
import { matchExistingRepository } from '../../lib/repository-matching'
import { ILaunchStats } from '../stats'
import { fatalError, assertNever } from '../fatal-error'
-import { isGitOnPath } from '../is-git-on-path'
import { shell } from '../app-shell'
import {
URLActionType,
@@ -610,12 +609,7 @@ export class Dispatcher {
path: string,
ignoreWarning: boolean = false
): Promise<void> {
- const gitFound = await isGitOnPath()
- if (gitFound || ignoreWarning) {
- this.appStore._openShell(path)
- } else {
- this.appStore._showPopup({ type: PopupType.InstallGit, path })
- }
+ return this.appStore._openShell(path, ignoreWarning)
}
/**
diff --git a/app/src/lib/shells/found-shell.ts b/app/src/lib/shells/found-shell.ts
index 557e486d8..6790b59bd 100644
--- a/app/src/lib/shells/found-shell.ts
+++ b/app/src/lib/shells/found-shell.ts
@@ -1,4 +1,5 @@
export interface IFoundShell<T> {
readonly shell: T
readonly path: string
+ readonly skipCheckForGit?: boolean
}
diff --git a/app/src/lib/shells/win32.ts b/app/src/lib/shells/win32.ts
index 9bfcb28a3..de6e48ee5 100644
--- a/app/src/lib/shells/win32.ts
+++ b/app/src/lib/shells/win32.ts
@@ -43,7 +43,7 @@ export function parse(label: string): Shell {
export async function getAvailableShells(): Promise<
ReadonlyArray<IFoundShell<Shell>>
> {
- const shells = [
+ const shells: Array<IFoundShell<Shell>> = [
{
shell: Shell.Cmd,
path: process.env.comspec || 'C:\\Windows\\System32\\cmd.exe',
@@ -79,6 +79,7 @@ export async function getAvailableShells(): Promise<
shells.push({
shell: Shell.GitBash,
path: gitBashPath,
+ skipCheckForGit: true,
})
}
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 456a18dde..98e100d8c 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -148,6 +148,7 @@ import {
setPersistedTheme,
} from '../../ui/lib/application-theme'
import { findAccountForRemoteURL } from '../find-account'
+import { isGitOnPath } from '../is-git-on-path'
/**
* Enum used by fetch to determine if
@@ -3004,12 +3005,23 @@ export class AppStore extends TypedBaseStore<IAppState> {
}
/** This shouldn't be called directly. See `Dispatcher`. */
- public async _openShell(path: string) {
+ public async _openShell(path: string, ignoreWarning: boolean) {
this.statsStore.recordOpenShell()
+ const match = await findShellOrDefault(this.selectedShell)
+
+ let gitFoundOnPath = match.skipCheckForGit === true || ignoreWarning
+
+ if (!gitFoundOnPath) {
+ gitFoundOnPath = await isGitOnPath()
+ }
+
try {
- const match = await findShellOrDefault(this.selectedShell)
- await launchShell(match, path, error => this._pushError(error))
+ if (gitFoundOnPath) {
+ await launchShell(match, path, error => this._pushError(error))
+ } else {
+ this._showPopup({ type: PopupType.InstallGit, path })
+ }
} catch (error) {
this.emitError(error)
}Reacted by LMLB
Metadata
Metadata
Assignees
Labels
integrationsIssues related to editor and shell integrations that ship in Desktoptech-debtIssues and pull requests related to addressing technical debt or improving the codebase

Activity
LMLB commentedon Jan 15, 2020
Why was this closed?
Neustradamus commentedon Apr 21, 2020
LMLB commentedon May 2, 2022
This is still not fixed.