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

PubMed Central: add checkbox support #1926

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@retorquere
Copy link
Contributor

retorquere commented Apr 7, 2019

Fixes #1925

@retorquere

This comment has been minimized.

Copy link
Contributor Author

retorquere commented Apr 7, 2019

This does not sort the checkboxes in the order they're found in the search. This can be added, but I figured I'd make the minimal changes to address the issue.

@@ -20,6 +44,8 @@ function detectWeb(doc, url) {
if (getSearchResults(doc, true)) {
return "multiple";
}

return undefined;

This comment has been minimized.

@dstillman

dstillman Apr 7, 2019

Member

If we're going to keep this rule, we should just return false for these.

This comment has been minimized.

@retorquere

retorquere Apr 7, 2019

Author Contributor

I'm fine with that, I just tried to fix the issue without introducing unnecessary semantic differences. Since undefined is returned implicitly, I figured making it explicit stayed closest to the original intent as expressed in the code.

This comment has been minimized.

@retorquere

retorquere Apr 7, 2019

Author Contributor

Can I change this particular commit without introducing a 3rd commit?

This comment has been minimized.

@dstillman

dstillman Apr 7, 2019

Member

Yes. Make the change, git add it, and then use git commit --fixup [hash-of-commit-you're-updating]. Then before merging, you or whoever merges this can use git rebase to squash the commit automatically (with either rebase.autosquash set to true globally, which I would recommend, or --autosquash).

https://riptutorial.com/git/example/3935/autosquash--committing-code-you-want-to-squash-during-a-rebase

(In this case you can just do the above and then force-push, since this is a small PR and easy to review.)

This comment has been minimized.

@retorquere

retorquere Apr 7, 2019

Author Contributor

Done the fixup and the force-push, but that still gave me a 3rd commit.

I'm not going to complain if someone else can do the rebase. rebase still terrifies me.

This comment has been minimized.

@dstillman

dstillman Apr 7, 2019

Member

Sorry, "the above" included the rebase. It'll be OK!

First, make sure this setting is on:

git config --global rebase.autosquash true

Then run git rebase -i 6005fa6^. That's the first commit in this PR plus ^ (which means the commit before that one).

You should see in your editor that the commits have been reordered, with the fixup commit automatically moved to after the first one. Save and close and it should be automatically merged. (Fixup means that the commit message is automatically discarded.) Then you can force push.

Technically you don't need to use -i in this case since there's nothing else to be done, but I always use it, since it's nice to see what's happening.

This comment has been minimized.

@retorquere

retorquere Apr 7, 2019

Author Contributor

I think that actually worked. I'll try to remember this.

@retorquere

This comment has been minimized.

Copy link
Contributor Author

retorquere commented Apr 7, 2019

The last test does not pass BTW, but it doesn't pass on the current PubMed Central.js either -- complains that doc is null but scaffold does not give line numbers.

retorquere added some commits Apr 7, 2019

@retorquere retorquere force-pushed the retorquere:PubMed_Central branch from 96f0220 to 9d5feb1 Apr 7, 2019

@adam3smith

This comment has been minimized.

Copy link
Collaborator

adam3smith commented Apr 7, 2019

@dstillman could you clarify what you preference on merging multi-commit PRs is?

Github does have, of course, the option to just squash on merge via GUI. Should I generally do this, or is the preferences to have the submitter squash into sensible commits (e.g. one for the code fix, one for the linting-related fixes), or something else?

@adam3smith

This comment has been minimized.

Copy link
Collaborator

adam3smith commented Apr 7, 2019

The last test does not pass BTW, but it doesn't pass on the current PubMed Central.js either -- complains that doc is null but scaffold does not give line numbers.

Yes, I think all tests on PDF pages currently fail. Not sure if that's fixable in the test-suite? Import into Zotero works fine.

@retorquere

This comment has been minimized.

Copy link
Contributor Author

retorquere commented Apr 7, 2019

@dstillman previously explicitly requested the lint-fix commit and the functionality commit be kept separate when submitting a PR.

@adam3smith

This comment has been minimized.

Copy link
Collaborator

adam3smith commented Apr 8, 2019

Absolutely, I want them separate for review, too. But it makes things easier to squash everything into one commit from the online GUI when merging.

@dstillman

This comment has been minimized.

Copy link
Member

dstillman commented Apr 8, 2019

Yes, I do think it's a good idea to keep lint commits separate post-merge — that way if we have to review the commit history later we can focus on what actually changed.

For most multi-commit PRs, squashing is fine, since there's no need to keep a permanent history of every tweak that was made in response to feedback while the PR was under review. But for things that will have meaning later, I think it's worth asking the submitter to rebase at the end into logical commits. (And as shown above, git commit --fixup also makes it easy to push reviewable changes that can be automatically squashed later. I suspect GitHub's PR rebase function doesn't use autosquash, but that'd make things even easier.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.