-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
lib: Rebrand getAtomAppName() function (fix shelling out to git
on macOS)
#13
Conversation
Fixes pushing to a git remote, and probably fixes shelling out to the system's `git` command in general.
Tangential Note: I would like anyone reviewing this to also consider #12 as well, since I'd like the repo code to work on If we are going to only include this package in the app after compiling to a |
Can you explain what is currently not working properly with shelling out to I came here to file this as an issue, but I don't want to create a new issue if this PR somehow addresses that behavior. Thanks! |
It seems to me this PR has an unrelated purpose to the performance issues you're describing. If you do want to open an issue, it would be appreciated, and hopefully someone will be able to narrow down the cause and what the fix would be. I can go ahead and describe what this PR fixes: In Electron on macOS, there is a main Electron binary, and a "helper" binary. This PR addresses a part of the Anything in this package that requires this "helper" binary in Pulsar will fail without the current PR due to "Pulsar.app/.../Atom Helper.app" not existing. The only use I am aware of in this package is shelling out to the CLI Thank you! EDIT TO ADD: You may want to try this, from the link you posted?
|
@pulsar-edit/core can I get a review of this? This fixes a user-facing issue where pushing branches/etc. doesn't work from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional chaining - I like it
Something to note - this function only exists in GitHub - but there is a similarly named function getAppName()
which is used elsewhere
Why they had two functions for the same result - I have no clue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love use of the optional chaining, the only thing I'd recommend here (But not at all needed) would instead of checking for a falsy
value with ||
I'd change that to use the Nullish Coalescing Operator ??
to check for strictly null
or undefined
on the left hand operator.
Like I said not at all needed, and only really provides a benefit if some weird stuff ends up in the name that we do want to show like an empty string which would evaluate as falsy
Otherwise approve and say we should merge!
Maybe we need to clarify about the branding API that the values in there (at least what we have so far) should definitely only be non-empty strings, since I feel like not doing that could break a bunch of other things throughout Pulsar... Hmm. Like I'm pretty sure we do string-only operations, or similar falsy checks as I did here, and package authors/fork developers should be able to do the same with confidence, IMO. Looking closer at this particular usageSnippet where this is actually used: Lines 95 to 99 in 6fc9e12
(And note: This is used to find a file path on disk of the (rebranded) Such as: If we're getting something falsy (but not |
Actually, I'm pretty sure there is an [ EDIT: never mind, the But so far I think we only use the |
Sorry if my two replies above are off-topic to I am personally against using |
Yeah that's totally fair. Like I said not required in any way. Guess I've spent to much time doing server side stuff and am prepared to get weird data from users, in which case in a situation like this the backend has to prepare to get weird stuff like an empty string back from whatever condition, and we failover only in cases where it's properly a But you are right, in this situation there is likely a lot else going wrong if the branding API is returning string based falsy values. So yeah no worries, otherwise totally approve the PR. |
I convinced myself to do the nullish after all, as someone intending to call their app If anyone forks Pulsar and names their app (That said: If anyone forks Pulsar and makes the branding API values the empty string |
Per review suggestion in the PR. This treats falsy but non-nullish inputs, such as Number 0, as valid. Other than digit zero `0`, I can't think of a falsy JS value that seems like a valid app name, so they're *probably* misusing the branding API at this point, but this is for whoever uses `0` as their `branding.name`. (Note: Please use string `"0"`, or any non-empty string for that matter, instead!)
Okay, thanks for the reviews, folks! Merging this! Hopefully will either get a couple more small fixes in to the Should be soon ™️! |
@DeeDeeG Glad to see you were convinced in the end aha. It isn't as clear to read, but once familiar with it becomes super helpful. Especially when you extrapolate the |
[ EDIT: this PR applies to macOS only ]
Fixes pushing to a git remote, and probably fixes shelling out to the system's
git
command in general.Note: I used the
branding
API, so if anyone forks Pulsar, this bit should hopefully still work for them. But if thebranding
API doesn't work/isn't available for whatever reason, this falls back to just returnPulsar Helper.app
(hard-coded). It was simple enough to do it this way, so I figured, "why not?"