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

Fix backport script on OS X #620

Merged
merged 2 commits into from Sep 12, 2020
Merged

Fix backport script on OS X #620

merged 2 commits into from Sep 12, 2020

Conversation

nylen
Copy link
Contributor

@nylen nylen commented Sep 4, 2020

Issue reported by @bahiirwa:

$ bin/backport-wp-commit.sh -c 42832
Found git remote 'wp' for WordPress/wordpress-develop
Found git remote 'origin' for ClassicPress/ClassicPress
Updating repositories from GitHub: WordPress...
Updating repositories from GitHub: ClassicPress...
Searching for r42832 in WP git: wp/4.9
Searching for r42832 in WP git: wp/5.0
Searching for r42832 in WP git: wp/5.1
Searching for r42832 in WP git: wp/5.2
Searching for r42832 in WP git: wp/5.3
Searching for r42832 in WP git: wp/5.4
Searching for r42832 in WP git: wp/master

Found commit: 5f56921131 on wp/master branch

Backporting commit using git cherry-pick
Modifying commit message

git status before:
UU src/wp-admin/css/dashboard.css
UU src/wp-admin/includes/dashboard.php
UU src/wp-includes/capabilities.php
UU tests/phpunit/tests/user/capabilities.php

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
        [-e pattern] [-f file] [--binary-files=value] [--color=when]
        [--context[=num]] [--directories=action] [--label] [--line-buffered]
        [--null] [pattern] [file ...]
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
        [-e pattern] [-f file] [--binary-files=value] [--color=when]
        [--context[=num]] [--directories=action] [--label] [--line-buffered]
        [--null] [pattern] [file ...]

git status after:
UU src/wp-admin/css/dashboard.css
UU src/wp-admin/includes/dashboard.php
UU src/wp-includes/capabilities.php
UU tests/phpunit/tests/user/capabilities.php

+ git commit --no-edit --allow-empty --author=Felix Arntz <flixos90@git.wordpress.org>
> error: Committing is not possible because you have unmerged files.
> hint: Fix them up in the work tree, and then use 'git add/rm <file>'
> hint: as appropriate to mark resolution and make a commit.
> fatal: Exiting because of an unresolved conflict.
> U     src/wp-admin/css/dashboard.css
> U     src/wp-admin/includes/dashboard.php
> U     src/wp-includes/capabilities.php
> U     tests/phpunit/tests/user/capabilities.php

OS X grep supports -E but not -P: https://ss64.com/osx/grep.html

The same issue exists in the Gruntfile for grunt precommit:git-conflicts so this PR should fix that too.

@bahiirwa
Copy link
Collaborator

bahiirwa commented Sep 7, 2020

This now works as expected.

This is my latest log from console on backport.

laurencebahiirwa@Laurences-iMac classicpress % git co -t origin/fix/backport-script-osx
Branch 'fix/backport-script-osx' set up to track remote branch 'fix/backport-script-osx' from 'origin'.
Switched to a new branch 'fix/backport-script-osx'
laurencebahiirwa@Laurences-iMac classicpress % bin/backport-wp-commit.sh -c 42832
Found git remote 'wp' for WordPress/wordpress-develop
Found git remote 'origin' for ClassicPress/ClassicPress
Updating repositories from GitHub: WordPress...
Updating repositories from GitHub: ClassicPress...
Searching for r42832 in WP git: wp/4.9
Searching for r42832 in WP git: wp/5.0
Searching for r42832 in WP git: wp/5.1
Searching for r42832 in WP git: wp/5.2
Searching for r42832 in WP git: wp/5.3
Searching for r42832 in WP git: wp/5.4
Searching for r42832 in WP git: wp/master

Found commit: 5f56921131 on wp/master branch

Backporting commit using git cherry-pick
Modifying commit message

git status before:
UU src/wp-admin/css/dashboard.css
UU src/wp-admin/includes/dashboard.php
UU src/wp-includes/capabilities.php
UU tests/phpunit/tests/user/capabilities.php


git status after:
M  src/wp-admin/css/dashboard.css
M  src/wp-admin/includes/dashboard.php
M  src/wp-includes/capabilities.php
M  tests/phpunit/tests/user/capabilities.php


=======
WARNING: Conflict detected!
Fix and commit the files that contain <<<< or >>>> conflict markers:
    - src/wp-admin/css/dashboard.css
    - src/wp-admin/includes/dashboard.php
    - src/wp-includes/capabilities.php
    - tests/phpunit/tests/user/capabilities.php
=======

If you're not sure how to do this, just push your changes to GitHub
and we can take care of it!

1 commit was added to your current branch.
laurencebahiirwa@Laurences-iMac classicpress % 

With the changes being backported and commited with conflicts as should be.

Screenshot 2020-09-07 at 19 52 19

Screenshot 2020-09-07 at 19 51 48

@mattyrob
Copy link
Collaborator

I'm on MacOS and until I stumbled across this ticket I hadn't really even noticed the error message.

With this patch applied I can push a changes without having to commit the files with conflicts first - saves a step for me and makes the preferred process easier for patch review.

@nylen
Copy link
Contributor Author

nylen commented Sep 12, 2020

I think this explains most of the malformed PRs that have been coming through. Thanks both of you for taking a look and confirming this now works as expected, I'll merge it now.

@nylen nylen merged commit 19371be into develop Sep 12, 2020
@nylen nylen deleted the fix/backport-script-osx branch September 12, 2020 01:04
@ClassyBot
Copy link
Contributor

This pull request has been mentioned on ClassicPress Forums. There might be relevant details there:

https://forums.classicpress.net/t/classicpress-1-2-0-release-notes/2516/1

@viktorix viktorix added the exclude For filtering purposes only. label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude For filtering purposes only.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants