• Bruce Dawson's avatar
    Fix slash direction sensitivity in git cl owners · 7a0b07a8
    Bruce Dawson authored
    Slashes and backslashes are interchangeable on Windows in many contexts.
    But not all. In particular, if you add a path to a dictionary and then
    try looking it up with an equivalent path that has different slashes
    then - not surprisingly - the lookup will fail. Therefore it is
    important to always use slashes when populating _paths_to_owners. This
    is now done, and documented.
    
    Additionally, while fnmatch.fnmatch handles comparing slash separated
    paths to backslash separated paths, fnmatch.translate does not. This is
    arguably a bug in fnmatch.translate, or at least something that should
    be documented. This bug is worked around by having _fnmatch sanitize
    file names to always use slashes, and asserting that the patterns do
    not contain backslashes.
    
    With these changes this command:
      git cl owners --ignore-current --show-all chrome/browser/BUILD.gn
    now correctly gives the same results as this command on Windows:
      git cl owners --ignore-current --show-all chrome\browser\BUILD.gn
    
    The modified test fails without the other changes, passes with them.
    
    Bug: 1009104
    Change-Id: I416c7131281f00e352c1d2b85c30fcc463417fa5
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1915410
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
    7a0b07a8
Name
Last commit
Last update
..
gstools Loading commit data...
OWNERS Loading commit data...
auth_test.py Loading commit data...
bot_update_coverage_test.py Loading commit data...
cipd_bootstrap_test.py Loading commit data...
detect_host_arch_test.py Loading commit data...
download_from_google_storage_unittest.py Loading commit data...
fetch_test.py Loading commit data...
fix_encoding_test.py Loading commit data...
gclient_cipd_smoketest.py Loading commit data...
gclient_eval_unittest.py Loading commit data...
gclient_git_smoketest.py Loading commit data...
gclient_paths_test.py Loading commit data...
gclient_scm_test.py Loading commit data...
gclient_smoketest.py Loading commit data...
gclient_smoketest_base.py Loading commit data...
gclient_test.py Loading commit data...
gclient_transitions_smoketest.py Loading commit data...
gclient_utils_test.py Loading commit data...
gerrit_client_test.py Loading commit data...
gerrit_util_test.py Loading commit data...
git_cache_test.py Loading commit data...
git_cl_creds_check_report.txt Loading commit data...
git_cl_test.py Loading commit data...
git_common_test.py Loading commit data...
git_dates_test.py Loading commit data...
git_drover_test.py Loading commit data...
git_find_releases_test.py Loading commit data...
git_footers_test.py Loading commit data...
git_hyper_blame_test.py Loading commit data...
git_map_test.py Loading commit data...
git_number_test.py Loading commit data...
git_rebase_update_test.py Loading commit data...
gsutil_test.py Loading commit data...
metrics_test.py Loading commit data...
my_activity_test.py Loading commit data...
ninjalog_uploader_test.py Loading commit data...
owners_finder_test.py Loading commit data...
owners_unittest.py Loading commit data...
presubmit_unittest.py Loading commit data...
recipes_test.py Loading commit data...
roll_dep_test.py Loading commit data...
scm_unittest.py Loading commit data...
subcommand_test.py Loading commit data...
subprocess2_test.py Loading commit data...
upload_to_google_storage_unittest.py Loading commit data...
watchlists_unittest.py Loading commit data...