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

Merged
merged 2 commits into from Apr 15, 2019
Merged

PubMed Central: add checkbox support #1926

merged 2 commits into from Apr 15, 2019

Conversation

retorquere
Copy link
Contributor

Fixes #1925

@retorquere
Copy link
Contributor Author

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;
Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

@retorquere retorquere Apr 7, 2019

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Member

Choose a reason for hiding this comment

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

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.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

@retorquere
Copy link
Contributor Author

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.

@adam3smith
Copy link
Collaborator

@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
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
Copy link
Contributor Author

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

@adam3smith
Copy link
Collaborator

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
Copy link
Member

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.)

@adam3smith adam3smith merged commit 5f1558e into zotero:master Apr 15, 2019
@adam3smith
Copy link
Collaborator

Great, thanks!

@retorquere retorquere deleted the PubMed_Central branch July 16, 2019 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

PubMed Central: Checkbox support
3 participants