Merge 'win-tests-fixes' into HEAD

This commit is contained in:
Johannes Schindelin
2013-12-29 19:18:12 -06:00
33 changed files with 236 additions and 117 deletions

View File

@@ -1480,6 +1480,9 @@ ifdef NO_REGEX
COMPAT_CFLAGS += -Icompat/regex
COMPAT_OBJS += compat/regex/regex.o
endif
ifdef NATIVE_CRLF
BASIC_CFLAGS += -DNATIVE_CRLF
endif
ifdef USE_NED_ALLOCATOR
COMPAT_CFLAGS += -Icompat/nedmalloc

View File

@@ -182,7 +182,9 @@ It does not apply to blobs recorded in its index.")"
}
clean_abort () {
test $# = 0 || echo >&2 "$@"
test $# = 0 || cat >&2 <<EOF
$@
EOF
rm -fr "$dotest"
exit 1
}

View File

@@ -71,7 +71,9 @@ do
case "$LF$common$LF" in
*"$LF$SHA1$LF"*)
echo "Already up-to-date with $pretty_name"
cat << EOF
Already up-to-date with $pretty_name
EOF
continue
;;
esac
@@ -83,7 +85,9 @@ do
# tree as the intermediate result of the merge.
# We still need to count this as part of the parent set.
echo "Fast-forwarding to: $pretty_name"
cat << EOF
Fast-forwarding to: $pretty_name
EOF
git read-tree -u -m $head $SHA1 || exit
MRC=$SHA1 MRT=$(git write-tree)
continue
@@ -91,7 +95,9 @@ do
NON_FF_MERGE=1
echo "Trying simple merge with $pretty_name"
cat << EOF
Trying simple merge with $pretty_name
EOF
git read-tree -u -m --aggressive $common $MRT $SHA1 || exit 2
next=$(git write-tree 2>/dev/null)
if test $? -ne 0

View File

@@ -62,7 +62,9 @@ GIT_QUIET=
say () {
if test -z "$GIT_QUIET"
then
printf '%s\n' "$*"
cat <<EOF
$*
EOF
fi
}

View File

@@ -431,9 +431,11 @@ cmd_add()
if test -z "$force" && ! git add --dry-run --ignore-missing "$sm_path" > /dev/null 2>&1
then
eval_gettextln "The following path is ignored by one of your .gitignore files:
\$sm_path
Use -f if you really want to add it." >&2
cat >&2 <<EOF
The following path is ignored by one of your .gitignore files:
$(eval_gettextln $sm_path)
Use -f if you really want to add it.
EOF
exit 1
fi

View File

@@ -230,27 +230,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
@@ -316,19 +316,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)' '
@@ -336,11 +336,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

@@ -19,7 +19,7 @@ check() {
false
fi &&
test_cmp expect-stdout stdout &&
test_cmp expect-stderr stderr
test_cmp_text expect-stderr stderr
}
read_chunk() {

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

@@ -80,4 +80,22 @@ test_expect_success 'autocrlf=true overrides unset eol' '
test -z "$onediff" -a -z "$twodiff"
'
test_expect_success NATIVE_CRLF 'eol native is crlf' '
rm -rf native_eol && mkdir native_eol &&
( cd native_eol &&
printf "*.txt text\n" > .gitattributes
printf "one\r\ntwo\r\nthree\r\n" > filedos.txt
printf "one\ntwo\nthree\n" > fileunix.txt
git init &&
git config core.autocrlf false &&
git config core.eol native &&
git add filedos.txt fileunix.txt &&
git commit -m "first" &&
rm file*.txt &&
git reset --hard HEAD &&
has_cr filedos.txt && has_cr fileunix.txt
)
'
test_done

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

@@ -15,7 +15,7 @@ test_expect_success 'read config: xdg file exists and ~/.gitconfig doesn'\''t' '
echo " myalias = !echo in_config" >>.config/git/config &&
echo in_config >expected &&
git myalias >actual &&
test_cmp expected actual
test_cmp_text expected actual
'
@@ -25,7 +25,7 @@ test_expect_success 'read config: xdg file exists and ~/.gitconfig exists' '
echo " myalias = !echo in_gitconfig" >>.gitconfig &&
echo in_gitconfig >expected &&
git myalias >actual &&
test_cmp expected actual
test_cmp_text expected actual
'

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

@@ -817,7 +817,7 @@ test_expect_success 'running "git rebase -i --exec git show HEAD"' '
git rebase -i HEAD~2 >expect
) &&
sed -e "1,9d" expect >expected &&
test_cmp expected actual
test_cmp_text expected actual
'
@@ -831,7 +831,7 @@ test_expect_success 'running "git rebase --exec git show HEAD -i"' '
git rebase -i HEAD~2 >expect
) &&
sed -e "1,9d" expect >expected &&
test_cmp expected actual
test_cmp_text expected actual
'
@@ -845,7 +845,7 @@ test_expect_success 'running "git rebase -ix git show HEAD"' '
git rebase -i HEAD~2 >expect
) &&
sed -e "1,9d" expect >expected &&
test_cmp expected actual
test_cmp_text expected actual
'
@@ -859,7 +859,7 @@ test_expect_success 'rebase -ix with several <CMD>' '
git rebase -i HEAD~2 >expect
) &&
sed -e "1,9d" expect >expected &&
test_cmp expected actual
test_cmp_text expected actual
'
@@ -874,7 +874,7 @@ test_expect_success 'rebase -ix with several instances of --exec' '
git rebase -i HEAD~2 >expect
) &&
sed -e "1,11d" expect >expected &&
test_cmp expected actual
test_cmp_text expected actual
'
@@ -900,7 +900,7 @@ test_expect_success 'rebase -ix with --autosquash' '
git rebase -i HEAD~4 >expect
) &&
sed -e "1,13d" expect >expected &&
test_cmp expected actual
test_cmp_text expected actual
'
@@ -919,7 +919,7 @@ test_expect_success 'rebase -i --exec without <CMD>' '
test_must_fail git rebase -i --exec 2>tmp &&
sed -e "1d" tmp >actual &&
test_must_fail git rebase -h >expected &&
test_cmp expected actual &&
test_cmp_text expected actual &&
git checkout master
'

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

@@ -13,7 +13,7 @@ This test tries to verify the sanity of the --submodule option of git diff.
# String "added" in German (translated with Google Translate), encoded in UTF-8,
# used in sample commit log messages in add_file() function below.
added=$(printf "hinzugef\303\274gt")
added=$(printf "hinzugef\303\274gt" | iconv -t utf-8)
add_file () {
(
cd "$1" &&

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,8 @@ 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 > commit_msg &&
git commit --file commit_msg &&
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

@@ -20,9 +20,13 @@ test_expect_success 'setup' '
mkdir .git/hooks
cat >.git/hooks/post-rewrite <<EOF
#!/bin/sh
echo \$@ > "$TRASH_DIRECTORY"/post-rewrite.args
cat > "$TRASH_DIRECTORY"/post-rewrite.data
#!/usr/bin/perl
open (AR, ">$TRASH_DIRECTORY/post-rewrite.args");
print AR \$_,"\n" foreach @ARGV;
open (DAT, ">$TRASH_DIRECTORY/post-rewrite.data");
while(<STDIN>) {
print DAT;
}
EOF
chmod u+x .git/hooks/post-rewrite

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,15 @@ test_expect_success 'setup' '
: >foo &&
git add foo &&
git config i18n.commitEncoding iso8859-1 &&
git commit -m "$added_iso88591" &&
echo "$added_iso88591" > commit-msg &&
git commit -F commit-msg &&
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" > commit-msg &&
git commit -a -F commit-msg &&
head2=$(git rev-parse --verify HEAD) &&
head2_short=$(git rev-parse --verify --short $head2) &&
tree2=$(git rev-parse --verify HEAD:) &&
@@ -206,13 +208,12 @@ test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '
)
'
iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF
Test printing of complex bodies
printf "Test printing of complex bodies
This commit message is much longer than the others,
and it will be encoded in iso8859-1. We should therefore
include an iso8859 character: ¡bueno!
EOF
include an iso8859 character: \302\241bueno!
" | iconv -f utf-8 -t iso8859-1 > commit-msg
test_expect_success 'setup complex body' '
git config i18n.commitencoding iso8859-1 &&

View File

@@ -72,6 +72,10 @@ test_expect_success 'Merge after setting text=auto' '
same line
EOF
if test_have_prereq NATIVE_CRLF; then
append_cr <expected >expected.temp &&
mv expected.temp expected
fi &&
git config merge.renormalize true &&
git rm -fr . &&
rm -f .gitattributes &&
@@ -86,6 +90,10 @@ test_expect_success 'Merge addition of text=auto' '
same line
EOF
if test_have_prereq NATIVE_CRLF; then
append_cr <expected >expected.temp &&
mv expected.temp expected
fi &&
git config merge.renormalize true &&
git rm -fr . &&
rm -f .gitattributes &&
@@ -95,16 +103,19 @@ test_expect_success 'Merge addition of text=auto' '
'
test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
q_to_cr <<-\EOF >expected &&
<<<<<<<
first line
same line
=======
first lineQ
same lineQ
>>>>>>>
EOF
echo "<<<<<<<" >expected &&
if test_have_prereq NATIVE_CRLF; then
echo first line | append_cr >>expected &&
echo same line | append_cr >>expected &&
echo ======= | append_cr >>expected
else
echo first line >>expected &&
echo same line >>expected &&
echo ======= >>expected
fi &&
echo first line | append_cr >>expected &&
echo same line | append_cr >>expected &&
echo ">>>>>>>" >>expected &&
git config merge.renormalize false &&
rm -f .gitattributes &&
git reset --hard a &&
@@ -114,16 +125,19 @@ test_expect_success 'Detect CRLF/LF conflict after setting text=auto' '
'
test_expect_success 'Detect LF/CRLF conflict from addition of text=auto' '
q_to_cr <<-\EOF >expected &&
<<<<<<<
first lineQ
same lineQ
=======
first line
same line
>>>>>>>
EOF
echo "<<<<<<<" >expected &&
echo first line | append_cr >>expected &&
echo same line | append_cr >>expected &&
if test_have_prereq NATIVE_CRLF; then
echo ======= | append_cr >>expected &&
echo first line | append_cr >>expected &&
echo same line | append_cr >>expected
else
echo ======= >>expected &&
echo first line >>expected &&
echo same line >>expected
fi &&
echo ">>>>>>>" >>expected &&
git config merge.renormalize false &&
rm -f .gitattributes &&
git reset --hard b &&

View File

@@ -16,7 +16,7 @@ commit_msg () {
msg="modify 2nd file (ge\303\244ndert)\n"
if test -n "$1"
then
printf "$msg" | iconv -f utf-8 -t "$1"
printf "$msg" | iconv -t "$1"
else
printf "$msg"
fi
@@ -60,7 +60,7 @@ check_changes () {
test_expect_success 'reset --hard message' '
hex=$(git log -1 --format="%h") &&
git reset --hard > .actual &&
echo HEAD is now at $hex $(commit_msg) > .expected &&
echo HEAD is now at $hex $(commit_msg utf-8) > .expected &&
test_cmp .expected .actual
'

View File

@@ -77,6 +77,10 @@ test_expect_success 'test basic "submodule foreach" usage' '
git config foo.bar zar &&
git submodule foreach "git config --file \"\$toplevel/.git/config\" foo.bar"
) &&
if test_have_prereq MINGW
then
dos2unix actual
fi &&
test_i18ncmp expect actual
'
@@ -174,6 +178,10 @@ test_expect_success 'test messages from "foreach --recursive"' '
cd clone2 &&
git submodule foreach --recursive "true" > ../actual
) &&
if test_have_prereq MINGW
then
dos2unix actual
fi &&
test_i18ncmp expect actual
'
@@ -192,6 +200,10 @@ test_expect_success 'test "foreach --quiet --recursive"' '
cd clone2 &&
git submodule foreach -q --recursive "echo \$name-\$path" > ../actual
) &&
if test_have_prereq MINGW
then
dos2unix actual
fi &&
test_cmp expect actual
'
@@ -239,6 +251,10 @@ test_expect_success 'test "status --recursive"' '
cd clone3 &&
git submodule status --recursive > ../actual
) &&
if test_have_prereq MINGW
then
dos2unix actual
fi &&
test_cmp expect actual
'

View File

@@ -253,7 +253,7 @@ test_expect_success PERL 'difftool --extcmd echo arg1' '
echo file >expect &&
git difftool --no-prompt \
--extcmd sh\ -c\ \"echo\ \$1\" branch >actual &&
test_cmp expect actual
test_cmp_text expect actual
'
test_expect_success PERL 'difftool --extcmd cat arg1' '
@@ -394,14 +394,14 @@ run_dir_diff_test 'difftool --dir-diff syncs worktree with unstaged change' '
echo "orig content" >file &&
git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
echo "new content" >expect &&
test_cmp expect file
test_cmp_text expect file
'
run_dir_diff_test 'difftool --dir-diff syncs worktree without unstaged change' '
test_when_finished git reset --hard &&
git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
echo "new content" >expect &&
test_cmp expect file
test_cmp_text expect file
'
write_script modify-file <<\EOF
@@ -412,7 +412,7 @@ test_expect_success PERL 'difftool --no-symlinks does not overwrite working tree
echo "orig content" >file &&
git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-file" branch &&
echo "new content" >expect &&
test_cmp expect file
test_cmp_text expect file
'
write_script modify-both-files <<\EOF
@@ -428,9 +428,9 @@ test_expect_success PERL 'difftool --no-symlinks detects conflict ' '
echo "orig content" >file &&
test_must_fail git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-both-files" branch &&
echo "wt content" >expect &&
test_cmp expect file &&
test_cmp_text expect file &&
echo "tmp content" >expect &&
test_cmp expect "$(cat tmpdir)/file"
test_cmp_text expect "$(cat tmpdir)/file"
)
'

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

@@ -96,7 +96,7 @@ EOF
test_expect_success $PREREQ \
'Verify commandline' \
'test_cmp expected commandline1'
'test_cmp_text expected commandline1'
test_expect_success $PREREQ 'Send patches with --envelope-sender' '
clean_fake_sendmail &&
@@ -116,7 +116,7 @@ EOF
test_expect_success $PREREQ \
'Verify commandline' \
'test_cmp expected commandline1'
'test_cmp_text expected commandline1'
test_expect_success $PREREQ 'Send patches with --envelope-sender=auto' '
clean_fake_sendmail &&
@@ -136,7 +136,7 @@ EOF
test_expect_success $PREREQ \
'Verify commandline' \
'test_cmp expected commandline1'
'test_cmp_text expected commandline1'
test_expect_success $PREREQ 'setup expect' "
cat >expected-show-all-headers <<\EOF
@@ -260,7 +260,7 @@ test_expect_success $PREREQ 'Show all headers' '
-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
>actual-show-all-headers &&
test_cmp expected-show-all-headers actual-show-all-headers
test_cmp_text expected-show-all-headers actual-show-all-headers
'
test_expect_success $PREREQ 'Prompting works' '
@@ -428,13 +428,13 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
2>errors &&
# The first message is a reply to --in-reply-to
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
test_cmp expect actual &&
test_cmp_text expect actual &&
# Second and subsequent messages are replies to the first one
sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
test_cmp expect actual &&
test_cmp_text expect actual &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
test_cmp expect actual
test_cmp_text expect actual
'
test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
@@ -449,13 +449,13 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
$patches $patches $patches \
2>errors &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
test_cmp expect actual &&
test_cmp_text expect actual &&
sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
test_cmp expect actual &&
test_cmp_text expect actual &&
sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
test_cmp expect actual
test_cmp_text expect actual
'
test_expect_success $PREREQ 'setup fake editor' '
@@ -527,7 +527,7 @@ test_suppression () {
-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
>actual-suppress-$1${2+"-$2"} &&
test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
test_cmp_text expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
}
test_expect_success $PREREQ 'sendemail.cc set' '
@@ -1243,7 +1243,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
grep email-using-8bit stdout &&
grep "Which 8bit encoding" stdout &&
egrep "Content|MIME" msgtxt1 >actual &&
test_cmp actual content-type-decl
test_cmp_text actual content-type-decl
'
test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
@@ -1254,7 +1254,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
--smtp-server="$(pwd)/fake.sendmail" \
email-using-8bit >stdout &&
egrep "Content|MIME" msgtxt1 >actual &&
test_cmp actual content-type-decl
test_cmp_text actual content-type-decl
'
test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
@@ -1266,7 +1266,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
--8bit-encoding=UTF-8 \
email-using-8bit >stdout &&
egrep "Content|MIME" msgtxt1 >actual &&
test_cmp actual content-type-decl
test_cmp_text actual content-type-decl
'
test_expect_success $PREREQ 'setup expect' '
@@ -1295,7 +1295,7 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' '
--8bit-encoding=UTF-8 \
email-using-8bit >stdout &&
grep "Subject" msgtxt1 >actual &&
test_cmp expected actual
test_cmp_text expected actual
'
# Note that the patches in this test are deliberately out of order; we

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
@@ -750,6 +754,7 @@ case $(uname -s) in
# exec does not inherit the PID
test_set_prereq MINGW
test_set_prereq NOT_CYGWIN
test_set_prereq NATIVE_CRLF
test_set_prereq SED_STRIPS_CR
test_set_prereq GREP_STRIPS_CR
GIT_TEST_CMP=mingw_test_cmp
@@ -787,12 +792,24 @@ else
test_set_prereq C_LOCALE_OUTPUT
fi
# Use this instead of test_cmp to compare files that are expected to contain
# text (and therefore it should not matter whether the line ends in an LF or
# a CR/LF).
test_cmp_text () {
if test_have_prereq MINGW
then
dos2unix "$1" &&
dos2unix "$2"
fi &&
test_cmp "$@"
}
# Use this instead of test_cmp to compare files that contain expected and
# actual output from git commands that can be translated. When running
# under GETTEXT_POISON this pretends that the command produced expected
# results.
test_i18ncmp () {
test -n "$GETTEXT_POISON" || test_cmp "$@"
test -n "$GETTEXT_POISON" || test_cmp_text "$@"
}
# Use this instead of "grep expected-string actual" to see if the