Skip to content

Ask that pass - #360

Merged
niik merged 19 commits into
masterfrom
ask-that-pass
Sep 20, 2016
Merged

niik merged 19 commits into
masterfrom
ask-that-pass

Conversation

@joshaber

@joshaber joshaber commented Sep 14, 2016 •

Copy link
Copy Markdown
Contributor

Dependent on desktop/dugite#18.

Dependent on #361.

Fixes #184

Authenticate our remote operations by setting ourselves as GIT_ASKPASS.

This is ending up a bit gnarlier than I'd hoped. In my ideal version, we would have pass our main process executable as GIT_ASKPASS. It'd find the user/password, write it out, and quit. Pretty straightforward. But that didn't work, for a few different reasons depending on the platform:

macOS

macOS won't launch another instance of an already-running app. We can force it to with open -n -a $PATH_TO_APP, but git will throw a fit if GIT_ASKPASS includes arguments. So we need to write a no-arguments executable that we can give GIT_ASKPASS that will launch the second instance of the app.

So we'll use a little trampoline script to do the open -n -a dance. But it turns out that if we use open -n -a to launch another instance of the app, users will be able to see that new instance launch and quit in the Dock. Gross.

Instead, the trampoline will use Electron's ability to run as node to execute a little script which will do all the work 💥

Windows

Unlike macOS, Windows is happy to launch another instance of the already-running app. But. On Windows, Electron doesn't attach stdout by default. And even launching the second instance of the app telling it to attach, I still couldn't get our main process to log anything to stdout for git to consume.

So we'll do the same dance we do on macOS. We'll use a little trampoline script to launch Electron in node mode, which will do the real work for us.

tl;dr: Rub some indirection on it.

@joshaber joshaber added this to the Internal Alpha milestone Sep 16, 2016
@joshaber joshaber changed the title [WIP] Ask that pass Ask that pass Sep 16, 2016
@joshaber

joshaber commented Sep 16, 2016 •

Copy link
Copy Markdown
Contributor Author

This is ready for review 🙏 Tested cloning and pulling private repos on both macOS and Windows.

See the body for a lil context.

@haacked

haacked commented Sep 16, 2016

Copy link
Copy Markdown
Contributor

I also tested on Windows by pulling and pushing to a private repository. Nice work! ✨

@niik niik mentioned this pull request Sep 20, 2016
@niik

niik commented Sep 20, 2016

Copy link
Copy Markdown
Member

Flawless victory. I know how much pain you had to suffer through to get this working but the end result is nicely contained and readable.

thank-you

@niik
niik merged commit 1b8917b into master Sep 20, 2016
@niik
niik deleted the ask-that-pass branch September 20, 2016 12:53
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.

3 participants