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

Gitblame: fix fatal error on chdir() when basepath is set and phpcs is run from subdir #67

Merged

Commits on Dec 5, 2023

  1. Gitblame: fix fatal error on chdir() when basepath is set and php…

    …cs is run from subdir
    
    The `Reporter::prepareFileReport()` method strips the `basepath` off the file name for the `$report['filename']`.
    
    https://github.com/squizlabs/PHP_CodeSniffer/blob/276f68cc74a3e4e1855bab6d01f0089337d00ae0/src/Reporter.php#L337
    
    While this is fine in most cases, for "blame" reports, the full path is needed.
    
    This changes the path passed to the `getBlameContent()` method in subclasses of the `VersionControl` class to the full path, which fixes the fatal error for the `Gitblame` report (and probably similar/related errors in the `Hgblame` and the `Svnblame` reports, but I don't have any repos to test this on).
    
    Fixes 3854
    jrfnl committed Dec 5, 2023
    Configuration menu
    Copy the full SHA
    a2667bc View commit details
    Browse the repository at this point in the history