diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1065,7 +1065,7 @@ class TTest(Test): while i < n: c = el[i] i += 1 - if c == '\\' and el[i] in '*?\\/': + if c == '\\' and i < n and el[i] in '*?\\/': res += el[i - 1:i + 1] i += 1 elif c == '*': diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -491,3 +491,17 @@ test for --json } (no-eol) #endif + +backslash on end of line with glob matching is handled properly + + $ cat > test-glob-backslash.t << EOF + > $ echo 'foo bar \\' + > foo * \ (glob) + > EOF + + $ $TESTDIR/run-tests.py --with-hg=`which hg` test-glob-backslash.t + . + # Ran 1 tests, 0 skipped, 0 warned, 0 failed. + + $ rm -f test-glob-backslash.t +