From e0a3df8c620c794cec55e99c1eb56bcca1f07822 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 30 Mar 2021 20:57:23 +0200 Subject: [PATCH 1/2] Fix the Python path on Windows On Windows, we want to run with a native Python, i.e. the separator is a semicolon, and the paths should be Windows paths (although they're allowed to have forward slashes instead of backslashes). Since we're most likely running this in an MSYS2 Bash, allow for `$TEST_DIRECTORY` to pretend to be a Unix path, and translate it via `cygpath` into a Windows path. Signed-off-by: Johannes Schindelin --- t/t9391-filter-repo-lib-usage.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/t/t9391-filter-repo-lib-usage.sh b/t/t9391-filter-repo-lib-usage.sh index 761f43a..059b6d5 100755 --- a/t/t9391-filter-repo-lib-usage.sh +++ b/t/t9391-filter-repo-lib-usage.sh @@ -4,7 +4,14 @@ test_description='Usage of git-filter-repo as a library' . ./test-lib.sh # for git_filter_repo.py import -export PYTHONPATH=$(dirname $TEST_DIRECTORY):$PYTHONPATH +case "$(uname -s)" in +MINGW*|MSYS) + export PYTHONPATH=$(cygpath -am $TEST_DIRECTORY/..)\;$PYTHONPATH + ;; +*) + export PYTHONPATH=$(dirname $TEST_DIRECTORY):$PYTHONPATH + ;; +esac # Avoid writing git_filter_repo.pyc file export PYTHONDONTWRITEBYTECODE=1 export CONTRIB_DIR=$TEST_DIRECTORY/../contrib/filter-repo-demos From fbaab1704c3ec2ab3f3891736036a313d54b81a5 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 30 Mar 2021 22:47:26 +0200 Subject: [PATCH 2/2] lint-history: do decode bytes This fixes the "TypeError: a bytes-like object is required, not 'str'" problem on Windows, letting t9391 pass. Signed-off-by: Johannes Schindelin --- contrib/filter-repo-demos/lint-history | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/filter-repo-demos/lint-history b/contrib/filter-repo-demos/lint-history index 4ec34ed..5b45b7e 100755 --- a/contrib/filter-repo-demos/lint-history +++ b/contrib/filter-repo-demos/lint-history @@ -114,7 +114,7 @@ def lint_with_real_filenames(commit, metadata): f.write(contents_plus_newline[:-1]) # Lint the file - subprocess.check_call(lint_args.command + [filename]) + subprocess.check_call(lint_args.command + [filename.decode('utf-8')]) # Get the new contents with open(filename, "rb") as f: