Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-3736: Use the system Git in electron. #3747

Merged
merged 1 commit into from
Dec 18, 2018
Merged

GH-3736: Use the system Git in electron. #3747

merged 1 commit into from
Dec 18, 2018

Conversation

kittaakos
Copy link
Contributor

If Git does not exist on the PATH,
fall back to the embedded Git.

Closes #3736.
Closes #3571.

@kittaakos
Copy link
Contributor Author

The Windows build fails with

lerna ERR! execute callback with error
2210lerna ERR! Error: Command failed: yarn run test
2211lerna ERR! error Command failed with exit code 4.
2212lerna ERR! 
2213lerna ERR! $ theiaext test
2214lerna ERR! 
2215lerna ERR! 
2216lerna ERR!   TypescriptVersionServiceImpl
2217lerna ERR!     1) resolveBundledVersionInApplicationPath
2218lerna ERR!     2) resolveBundledVersionWithRequire
2219lerna ERR!     3) resolveBundledVersionAsExecutable
2220lerna ERR!     4) getVersions
2221lerna ERR! 
2222lerna ERR!   typescript package
2223lerna ERR!     √ should support code coverage statistics
2224lerna ERR! 
2225lerna ERR! 
2226lerna ERR!   1 passing (3s)
2227lerna ERR!   4 failing
2228lerna ERR! 
2229lerna ERR!   1) TypescriptVersionServiceImpl resolveBundledVersionInApplicationPath:
2230lerna ERR!      AssertionError [ERR_ASSERTION]: undefined == 'node_modules/typescript/lib'
2231lerna ERR!       at Suite.<anonymous> (src\node\typescript-version-service-impl.spec.ts:43:16)
2232lerna ERR!       at step (src\node\typescript-version-service-impl.spec.ts:47:23)
2233lerna ERR!       at Object.next (src\node\typescript-version-service-impl.spec.ts:28:53)
2234lerna ERR!       at fulfilled (src\node\typescript-version-service-impl.spec.ts:19:58)
2235lerna ERR!       at <anonymous>
2236lerna ERR! 
2237lerna ERR!   2) TypescriptVersionServiceImpl resolveBundledVersionWithRequire:
2238lerna ERR!      AssertionError [ERR_ASSERTION]: undefined == 'node_modules/typescript/lib'
2239lerna ERR!       at Suite.<anonymous> (src\node\typescript-version-service-impl.spec.ts:48:16)
2240lerna ERR!       at step (src\node\typescript-version-service-impl.spec.ts:47:23)
2241lerna ERR!       at Object.next (src\node\typescript-version-service-impl.spec.ts:28:53)
2242lerna ERR!       at fulfilled (src\node\typescript-version-service-impl.spec.ts:19:58)
2243lerna ERR!       at <anonymous>
2244lerna ERR! 
2245lerna ERR!   3) TypescriptVersionServiceImpl resolveBundledVersionAsExecutable:
2246lerna ERR!      Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
2247lerna ERR!       at <anonymous>
2248lerna ERR! 
2249lerna ERR!   4) TypescriptVersionServiceImpl getVersions:
2250lerna ERR! 
2251lerna ERR!       AssertionError [ERR_ASSERTION]: 'Bundled: undefined\r\nWorkspace: undefined' == 'Bundled: node_modules/typescript/lib\r\nWorkspace: node_modules/typescript/lib'
2252lerna ERR!       + expected - actual
2253lerna ERR! 
2254lerna ERR!       -Bundled: undefined
2255lerna ERR!       -Workspace: undefined
2256lerna ERR!       +Bundled: node_modules/typescript/lib
2257lerna ERR!       +Workspace: node_modules/typescript/lib
2258lerna ERR!       
2259lerna ERR!       at Suite.<anonymous> (src\node\typescript-version-service-impl.spec.ts:60:16)
2260lerna ERR!       at step (src\node\typescript-version-service-impl.spec.ts:47:23)
2261lerna ERR!       at Object.next (src\node\typescript-version-service-impl.spec.ts:28:53)
2262lerna ERR!       at fulfilled (src\node\typescript-version-service-impl.spec.ts:19:58)
2263lerna ERR!       at <anonymous>
2264lerna ERR! 
2265lerna ERR! 
2266lerna ERR! 
2267lerna ERR! info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2268lerna ERR! 
2269lerna ERR!     at Promise.all.then.arr (C:\projects\theia\node_modules\lerna\node_modules\execa\index.js:236:11)
2270lerna ERR!     at <anonymous>
2271{ Error: Command failed: yarn run test
2272error Command failed with exit code 4.
2273

Although I do not have the failing typescript-version-service-impl.spec.ts module in my branch. Any ideas what's oging on, @akosyakov?

@kittaakos
Copy link
Contributor Author

@svenefftinge, @AlexTugarev can one of you look into this? Thanks!

// tslint:disable-next-line:no-any
protected async handleExternalNotFound(err?: any): Promise<void> {
if (err) {
this.logger.error(err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we notify users in such cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Oh sure. I did not want to log the stack trace; the user cannot do much with that, but I wanted to "log" Could not find Git on the PATH. Falling back to the embedded Git. via the messageService.

If Git does not exisit on the `PATH`,
fall back to the embedded Git.

Closes #3736.

Signed-off-by: Akos Kitta <[email protected]>
@kittaakos
Copy link
Contributor Author

kittaakos commented Dec 18, 2018

@AlexTugarev, please retake a look. This time, the PR is without the message service notifications. We can handle it in a follow-up if needed.

Copy link
Contributor

@AlexTugarev AlexTugarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Testing the Electron app now.

if (!!execPath && !!path && !!version) {
// https:/desktop/dugite/issues/111#issuecomment-323222834
// Instead of the executable path, we need the root directory of Git.
const dir = dirname(dirname(path));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if path is e.g. /usr/local/bin/git, dir is supposed to be /usr/local?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️ Yes, there is the comment above the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! ;-)

@AlexTugarev
Copy link
Contributor

Works fine!

Just verified, that the git from PATH is found:

root INFO Using Git [2.19.1] from the PATH. (/usr/local/bin/git)

Then, after managing to "disable" Apple's default git, I could test the fallback to embedded git as well.

root INFO Could not find Git on the PATH. Falling back to the embedded Git.
root INFO '--no-optional-locks' is a valid Git option for the current Git version: '2.17.1'.

Also, put a breakpoint into dugite code, just to make sure it shows the proper git location.

"/Users/tugarev/Projects/theia/B/node_modules/dugite/git/bin/git"

Copy link
Contributor

@AlexTugarev AlexTugarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine!

@kittaakos
Copy link
Contributor Author

Wow, thanks for the review @AlexTugarev! The Windows build is the good old

Error: An unknown server-side error occurred while processing the command.\n    at execute("return window.__coverage__;") - C:\projects\theia\node_modules\wdio-sync\build\index.js:244:37\n    at elements("div#theia-statusBar") - 

I am going to merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants