Merge 'win-tests-fixes' into HEAD

This commit is contained in:
Johannes Schindelin
2014-05-10 16:57:01 -05:00
19 changed files with 94 additions and 51 deletions

View File

@@ -251,27 +251,27 @@ test_expect_success 'blame -L X,-N' '
'
test_expect_success 'blame -L /RE/ (RE to end)' '
check_count -L/evil/ C 1 "A U Thor" 1
check_count -L/\;*evil/ C 1 "A U Thor" 1
'
test_expect_success 'blame -L /RE/,/RE2/' '
check_count -L/robot/,/green/ A 1 B 1 B2 1 D 1 E 1
check_count -L/\;*robot/,/\;*green/ A 1 B 1 B2 1 D 1 E 1
'
test_expect_success 'blame -L X,/RE/' '
check_count -L5,/evil/ B1 1 D 1 "A U Thor" 1
check_count -L5,/\;*evil/ B1 1 D 1 "A U Thor" 1
'
test_expect_success 'blame -L /RE/,Y' '
check_count -L/99/,7 B1 1 D 1 "A U Thor" 1
check_count -L/\;*99/,7 B1 1 D 1 "A U Thor" 1
'
test_expect_success 'blame -L /RE/,+N' '
check_count -L/99/,+3 B1 1 D 1 "A U Thor" 1
check_count -L/\;*99/,+3 B1 1 D 1 "A U Thor" 1
'
test_expect_success 'blame -L /RE/,-N' '
check_count -L/99/,-3 B 1 B2 1 D 1
check_count -L/\;*99/,-3 B 1 B2 1 D 1
'
# 'file' ends with an incomplete line, so 'wc' reports one fewer lines than
@@ -337,19 +337,19 @@ test_expect_success 'blame -L multiple (superset/subset: unordered)' '
'
test_expect_success 'blame -L /RE/ (relative)' '
check_count -L3,3 -L/fox/ B1 1 B2 1 C 1 D 1 "A U Thor" 1
check_count -L3,3 -L/\;*fox/ B1 1 B2 1 C 1 D 1 "A U Thor" 1
'
test_expect_success 'blame -L /RE/ (relative: no preceding range)' '
check_count -L/dog/ A 1 B 1 B1 1 B2 1 C 1 D 1 "A U Thor" 1
check_count -L/\;*dog/ A 1 B 1 B1 1 B2 1 C 1 D 1 "A U Thor" 1
'
test_expect_success 'blame -L /RE/ (relative: adjacent)' '
check_count -L1,1 -L/dog/,+1 A 1 E 1
check_count -L1,1 -L/\;*dog/,+1 A 1 E 1
'
test_expect_success 'blame -L /RE/ (relative: not found)' '
test_must_fail $PROG -L4,4 -L/dog/ file
test_must_fail $PROG -L4,4 -L/\;*dog/ file
'
test_expect_success 'blame -L /RE/ (relative: end-of-file)' '
@@ -357,11 +357,11 @@ test_expect_success 'blame -L /RE/ (relative: end-of-file)' '
'
test_expect_success 'blame -L ^/RE/ (absolute)' '
check_count -L3,3 -L^/dog/,+2 A 1 B2 1
check_count -L3,3 -L^/\;*dog/,+2 A 1 B2 1
'
test_expect_success 'blame -L ^/RE/ (absolute: no preceding range)' '
check_count -L^/dog/,+2 A 1 B2 1
check_count -L^/\;*dog/,+2 A 1 B2 1
'
test_expect_success 'blame -L ^/RE/ (absolute: not found)' '

View File

@@ -5,7 +5,13 @@ test_description=check-ignore
. ./test-lib.sh
init_vars () {
global_excludes="$(pwd)/global-excludes"
# On Windows, avoid using "C:" in the global-excludes paths.
if test_have_prereq MINGW
then
global_excludes="global-excludes"
else
global_excludes="$(pwd)/global-excludes"
fi
}
enable_global_excludes () {

View File

@@ -29,7 +29,7 @@ test_expect_success '0-length read, send along greeting' '
test_cmp expect actual
'
test_expect_success 'read from file descriptor' '
test_expect_success NOT_MINGW 'read from file descriptor' '
rm -f input &&
echo hello >expect &&
echo hello >input &&

View File

@@ -117,7 +117,7 @@ test_expect_success 'url general escapes' '
test "$(test-urlmatch-normalization -p "X://W?'\!'")" = "x://w/?'\!'"
'
test_expect_success 'url high-bit escapes' '
test_expect_success !MINGW 'url high-bit escapes' '
test "$(test-urlmatch-normalization -p "$(cat "$tu-1")")" = "x://q/%01%02%03%04%05%06%07%08%0E%0F%10%11%12" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-2")")" = "x://q/%13%14%15%16%17%18%19%1B%1C%1D%1E%1F%7F" &&
test "$(test-urlmatch-normalization -p "$(cat "$tu-3")")" = "x://q/%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" &&

View File

@@ -9,10 +9,10 @@ test_expect_success setup '
# clone does not allow us to pass core.bigfilethreshold to
# new repos, so set core.bigfilethreshold globally
git config --global core.bigfilethreshold 200k &&
echo X | dd of=large1 bs=1k seek=2000 &&
echo X | dd of=large2 bs=1k seek=2000 &&
echo X | dd of=large3 bs=1k seek=2000 &&
echo Y | dd of=huge bs=1k seek=2500 &&
perl -e "print \"\\0\" x 2048000; print \"X\\n\";" > large1 &&
perl -e "print \"\\0\" x 2048000; print \"X\\n\";" > large2 &&
perl -e "print \"\\0\" x 2048000; print \"X\\n\";" > large3 &&
perl -e "print \"\\0\" x 2560000; print \"Y\\n\";" > huge &&
GIT_ALLOC_LIMIT=1500 &&
export GIT_ALLOC_LIMIT
'

View File

@@ -339,6 +339,10 @@ test_expect_success 'make_relative_path handles double slashes in GIT_DIR' '
git --git-dir="$(pwd)//repo.git" --work-tree="$(pwd)" add dummy_file
'
test_have_prereq MINGW &&
# make sure to test DOS path on Windows
TRASH_DIRECTORY="$(cd "$TRASH_DIRECTORY" && pwd)"
test_expect_success 'relative $GIT_WORK_TREE and git subprocesses' '
GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work \
test-subprocess --setup-work-tree rev-parse --show-toplevel >actual &&

View File

@@ -4,14 +4,14 @@ test_description='ls-tree with(out) globs'
. ./test-lib.sh
test_expect_success 'setup' '
test_expect_success NOT_MINGW 'setup' '
mkdir a aa "a[a]" &&
touch a/one aa/two "a[a]/three" &&
git add a/one aa/two "a[a]/three" &&
git commit -m test
'
test_expect_success 'ls-tree a[a] matches literally' '
test_expect_success NOT_MINGW 'ls-tree a* matches literally' '
cat >expected <<EOF &&
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a[a]/three
EOF

View File

@@ -54,10 +54,13 @@ test_expect_success setup '
git add yours &&
git commit -s -m "Second on side" &&
# the second one on the side branch is ISO-8859-1
git config i18n.commitencoding ISO8859-1 &&
# use author and committer name in ISO-8859-1 to match it.
. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
if test_have_prereq NOT_MINGW
then
# the second one on the side branch is ISO-8859-1
git config i18n.commitencoding ISO8859-1 &&
# use author and committer name in ISO-8859-1 to match it.
. "$TEST_DIRECTORY"/t3901-8859-1.txt
fi &&
test_tick &&
echo Yet another >theirs &&
git add theirs &&
@@ -119,7 +122,7 @@ test_expect_success 'rebase (U/L)' '
check_encoding 2
'
test_expect_success 'rebase (L/L)' '
test_expect_success NOT_MINGW 'rebase (L/L)' '
# In this test we want ISO-8859-1 encoded commits as the result
git config i18n.commitencoding ISO8859-1 &&
git config i18n.logoutputencoding ISO8859-1 &&
@@ -131,7 +134,7 @@ test_expect_success 'rebase (L/L)' '
check_encoding 2 8859
'
test_expect_success 'rebase (L/U)' '
test_expect_success NOT_MINGW 'rebase (L/U)' '
# This is pathological -- use UTF-8 as intermediate form
# to get ISO-8859-1 results.
git config i18n.commitencoding ISO8859-1 &&
@@ -159,7 +162,7 @@ test_expect_success 'cherry-pick(U/U)' '
check_encoding 3
'
test_expect_success 'cherry-pick(L/L)' '
test_expect_success NOT_MINGW 'cherry-pick(L/L)' '
# Both the commitencoding and logoutputencoding is set to ISO-8859-1
git config i18n.commitencoding ISO8859-1 &&
@@ -189,7 +192,7 @@ test_expect_success 'cherry-pick(U/L)' '
check_encoding 3
'
test_expect_success 'cherry-pick(L/U)' '
test_expect_success NOT_MINGW 'cherry-pick(L/U)' '
# Again, the commitencoding is set to ISO-8859-1 but
# logoutputencoding is set to UTF-8.

View File

@@ -23,8 +23,10 @@ add_file () {
echo "$name" >"$name" &&
git add "$name" &&
test_tick &&
msg_added_iso88591=$(echo "Add $name ($added $name)" | iconv -f utf-8 -t iso8859-1) &&
git -c 'i18n.commitEncoding=iso8859-1' commit -m "$msg_added_iso88591"
# "git commit -m" would break MinGW, as Windows refuse to pass
# iso8859-1 encoded parameter to git.
echo "Add $name ($added $name)" | iconv -f utf-8 -t iso8859-1 |
git -c 'i18n.commitEncoding=iso8859-1' commit -F -
done >/dev/null &&
git rev-parse --short --verify HEAD
)

View File

@@ -93,7 +93,7 @@ test_expect_success 'output from user-defined format is re-wrapped' '
test_cmp expect log.predictable
'
test_expect_success 'shortlog wrapping' '
test_expect_success NOT_MINGW 'shortlog wrapping' '
cat >expect <<\EOF &&
A U Thor (5):
Test
@@ -114,7 +114,7 @@ EOF
test_cmp expect out
'
test_expect_success 'shortlog from non-git directory' '
test_expect_success NOT_MINGW 'shortlog from non-git directory' '
git log HEAD >log &&
GIT_DIR=non-existing git shortlog -w <log >out &&
test_cmp expect out
@@ -159,7 +159,7 @@ $DSCHO (2):
EOF
test_expect_success 'shortlog encoding' '
test_expect_success NOT_MINGW 'shortlog encoding' '
git reset --hard "$commit" &&
git config --unset i18n.commitencoding &&
echo 2 > a1 &&

View File

@@ -28,7 +28,7 @@ test_expect_success 'set up basic repos' '
git add foo &&
test_tick &&
git config i18n.commitEncoding iso8859-1 &&
git commit -m "$(commit_msg iso8859-1)" &&
commit_msg iso8859-1 | git commit -F - &&
git add bar &&
test_tick &&
git commit -m "add bar" &&

View File

@@ -34,7 +34,7 @@ test_expect_success 'log --grep searches in log output encoding (utf8)' '
test_cmp expect actual
'
test_expect_success 'log --grep searches in log output encoding (latin1)' '
test_expect_success NOT_MINGW 'log --grep searches in log output encoding (latin1)' '
cat >expect <<-\EOF &&
latin1
utf8
@@ -43,7 +43,7 @@ test_expect_success 'log --grep searches in log output encoding (latin1)' '
test_cmp expect actual
'
test_expect_success 'log --grep does not find non-reencoded values (utf8)' '
test_expect_success NOT_MINGW 'log --grep does not find non-reencoded values (utf8)' '
>expect &&
git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
test_cmp expect actual

View File

@@ -101,7 +101,7 @@ test_expect_success 'push with receive.fsckobjects' '
git config transfer.fsckobjects false
) &&
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
test_cmp exp act
test_cmp exp act || test ! -s act
'
test_expect_success 'push with transfer.fsckobjects' '
@@ -112,7 +112,7 @@ test_expect_success 'push with transfer.fsckobjects' '
git config transfer.fsckobjects true
) &&
test_must_fail git push --porcelain dst master:refs/heads/test >act &&
test_cmp exp act
test_cmp exp act || test ! -s act
'
test_done

View File

@@ -22,13 +22,13 @@ test_expect_success 'setup' '
: >foo &&
git add foo &&
git config i18n.commitEncoding iso8859-1 &&
git commit -m "$added_iso88591" &&
echo "$added_iso88591" | git commit -F - &&
head1=$(git rev-parse --verify HEAD) &&
head1_short=$(git rev-parse --verify --short $head1) &&
tree1=$(git rev-parse --verify HEAD:) &&
tree1_short=$(git rev-parse --verify --short $tree1) &&
echo "$changed" > foo &&
git commit -a -m "$changed_iso88591" &&
echo "$changed_iso88591" | git commit -a -F - &&
head2=$(git rev-parse --verify HEAD) &&
head2_short=$(git rev-parse --verify --short $head2) &&
tree2=$(git rev-parse --verify HEAD:) &&

View File

@@ -41,7 +41,9 @@ test_expect_success 'creating initial files and commits' '
echo "1st line 2nd file" >secondfile &&
echo "2nd line 2nd file" >>secondfile &&
git -c "i18n.commitEncoding=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" &&
# "git commit -m" would break MinGW, as Windows refuse to pass
# iso8859-1 encoded parameter to git.
commit_msg iso8859-1 | git -c "i18n.commitEncoding=iso8859-1" commit -a -F - &&
head5=$(git rev-parse --verify HEAD)
'
# git log --pretty=oneline # to see those SHA1 involved
@@ -331,7 +333,9 @@ test_expect_success 'redoing the last two commits should succeed' '
echo "1st line 2nd file" >secondfile &&
echo "2nd line 2nd file" >>secondfile &&
git -c "i18n.commitEncoding=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" &&
# "git commit -m" would break MinGW, as Windows refuse to pass
# iso8859-1 encoded parameter to git.
commit_msg iso8859-1 | git -c "i18n.commitEncoding=iso8859-1" commit -a -F - &&
check_changes $head5
'

View File

@@ -33,7 +33,7 @@ author $SJIS_NAME
summary $SJIS_MSG
EOF
test_expect_success \
test_expect_success NOT_MINGW \
'blame respects i18n.commitencoding' '
git blame --incremental file | \
egrep "^(author|summary) " > actual &&
@@ -49,7 +49,7 @@ author $EUC_JAPAN_NAME
summary $EUC_JAPAN_MSG
EOF
test_expect_success \
test_expect_success NOT_MINGW \
'blame respects i18n.logoutputencoding' '
git config i18n.logoutputencoding eucJP &&
git blame --incremental file | \
@@ -66,7 +66,7 @@ author $UTF8_NAME
summary $UTF8_MSG
EOF
test_expect_success \
test_expect_success NOT_MINGW \
'blame respects --encoding=UTF-8' '
git blame --incremental --encoding=UTF-8 file | \
egrep "^(author|summary) " > actual &&
@@ -82,7 +82,7 @@ author $UTF8_NAME
summary $UTF8_MSG
EOF
test_expect_success \
test_expect_success NOT_MINGW \
'blame respects --encoding=none' '
git blame --incremental --encoding=none file | \
egrep "^(author|summary) " > actual &&

View File

@@ -504,4 +504,15 @@ test_expect_success 'refs are updated even if no commits need to be exported' '
test_cmp expected actual
'
cat > expected << EOF
reset refs/heads/master
from $(git rev-parse master)
EOF
test_expect_failure 'refs are updated even if no commits need to be exported' '
git fast-export master..master > actual &&
test_cmp expected actual
'
test_done

View File

@@ -212,9 +212,18 @@ test_expect_success '__gitdir - non-existing $GIT_DIR' '
)
'
function pwd_P_W () {
if test_have_prereq MINGW
then
pwd -W
else
pwd -P
fi
}
test_expect_success '__gitdir - gitfile in cwd' '
echo "$(pwd -P)/otherrepo/.git" >expected &&
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git &&
echo "$(pwd_P_W)/otherrepo/.git" >expected &&
echo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git &&
test_when_finished "rm -f subdir/.git" &&
(
cd subdir &&
@@ -224,8 +233,8 @@ test_expect_success '__gitdir - gitfile in cwd' '
'
test_expect_success '__gitdir - gitfile in parent' '
echo "$(pwd -P)/otherrepo/.git" >expected &&
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git &&
echo "$(pwd_P_W)/otherrepo/.git" >expected &&
echo "gitdir: $(pwd_P_W)/otherrepo/.git" >subdir/.git &&
test_when_finished "rm -f subdir/.git" &&
(
cd subdir/subsubdir &&

View File

@@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/ .
# for git on windows so stdin will not be misdetected as attached to a
# terminal
exec < /dev/null
# Keep the original TERM for say_color
ORIGINAL_TERM=$TERM