• Bruce Dawson's avatar
    Actually add a trailing slash to dir_with_slash · 31bfd519
    Bruce Dawson authored
    AffectedFiles carefully added a slash to dir_with_slash, but then called
    normpath - which trims trailing path separators. This meant that
    ui/views/PRESUBMIT.py would analyze files in ui\views_content_client,
    leading to spooky action at a distance. This was noticed when this
    command triggered a presubmit error:
    
        git cl presubmit "--files=ui/views_content_client/*.cc;ui/views/readme.md"
    
    when running presubmit on either file individually found nothing.
    
    This change was tested by getting CheckChangeLintsClean to print the
    files that it was asked to analyze, making the behavior quite obvious.
    
    This bug appears to have existed for about thirteen years, but only
    triggers in rare cases, and even then the incorrect behavior was almost
    impossible to notice.
    
    One of the tests was inadvertently testing the broken AffectedFiles
    behavior and another seemed to be requiring it to handle '.'
    correctly which I'm not sure we want to support.
    
    Bug: 1309977
    Change-Id: Ibdc39981d69664b03448acb228d4ab05b49436f6
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3632034
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
    31bfd519
presubmit_support.py 70.8 KB