tattersoftware / codeigniter4-patches

Automated project updates for CodeIgniter 4
MIT License
29 stars 8 forks source link

Can't patch 4.2.0 -> 4.2.1 #24

Closed jozefrebjak closed 2 years ago

jozefrebjak commented 2 years ago

It seems as an issue with PHPStan.

git version 2.34.1
Composer version 2.2.9 2022-03-15 22:13:37
************************************
*          CONFIGURATION           *
************************************

Scripts Directory: /app/vendor/tatter/patches/src
Project Directory: /app
Target Version:    
Current Version:   
Source Package:    codeigniter4/framework
Base Branch:       develop
Selected Items:    app/ public/ env spark

************************************
*             STAGING              *
************************************

Switched to a new branch 'tatter/scratch'
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Starting CodeIgniter precommit...
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading codeigniter4/framework (v4.2.0 => v4.2.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Downloading codeigniter4/framework (v4.2.1)
  - Upgrading codeigniter4/framework (v4.2.0 => v4.2.1): Extracting archive
Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
Generating autoload files
67 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
phpstan/extension-installer: Extensions installed
Starting CodeIgniter precommit...
Linting PHP code...
No syntax errors detected in /app/app/Config/Mimes.php
Running PHPStan...
At least one path must be specified to analyse.
Fix the phpstan error(s) before commit.
exit status 1
MGatner commented 2 years ago

It appears that you have two issues.

  1. The script needs to check out a few files from your original state; it does this by storing the originating branch in $BASE and then calling git checkout against it. At this point in the script you got this error message:

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

This makes me think Git was unable to identify your starting branch so $BASE = HEAD. Make sure you aren't in detached HEAD state when running the script.

  1. PHPStan appears to run on the stub version of the patch process. This is most likely due to a post-update-command specified in your composer.json. I can add a --no-verify flag to the commit step but in the meantime try disabling your "post-" commands before running patch.
jozefrebjak commented 2 years ago

@MGatner Removing post-update-command was a solution.

MGatner commented 2 years ago

Great! Please leave this Issue open as a reminder to add --no-verify.