diff options
Diffstat (limited to 't')
26 files changed, 373 insertions, 95 deletions
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index bfdff2a8c9..b43162ea2a 100644 --- a/t/lib-httpd.sh +++ b/t/lib-httpd.sh @@ -64,7 +64,7 @@ case $(uname) in esac LIB_HTTPD_PATH=${LIB_HTTPD_PATH-"$DEFAULT_HTTPD_PATH"} -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'} +LIB_HTTPD_PORT=${LIB_HTTPD_PORT-${this_test#t}} TEST_PATH="$TEST_DIRECTORY"/lib-httpd HTTPD_ROOT_PATH="$PWD"/httpd diff --git a/t/lib-terminal.sh b/t/lib-terminal.sh index 9a2dca506a..51845491bb 100644 --- a/t/lib-terminal.sh +++ b/t/lib-terminal.sh @@ -1,6 +1,20 @@ # Helpers for terminal output tests. -test_expect_success PERL 'set up terminal for tests' ' +# Catch tests which should depend on TTY but forgot to. There's no need +# to aditionally check that the TTY prereq is set here. If the test declared +# it and we are running the test, then it must have been set. +test_terminal () { + if ! test_declared_prereq TTY + then + echo >&4 "test_terminal: need to declare TTY prerequisite" + return 127 + fi + perl "$TEST_DIRECTORY"/test-terminal.perl "$@" +} + +test_lazy_prereq TTY ' + test_have_prereq PERL && + # Reading from the pty master seems to get stuck _sometimes_ # on Mac OS X 10.5.0, using Perl 5.10.0 or 5.8.9. # @@ -15,21 +29,8 @@ test_expect_success PERL 'set up terminal for tests' ' # After 2000 iterations or so it hangs. # https://rt.cpan.org/Ticket/Display.html?id=65692 # - if test "$(uname -s)" = Darwin - then - : - elif - perl "$TEST_DIRECTORY"/test-terminal.perl \ - sh -c "test -t 1 && test -t 2" - then - test_set_prereq TTY && - test_terminal () { - if ! test_declared_prereq TTY - then - echo >&4 "test_terminal: need to declare TTY prerequisite" - return 127 - fi - perl "$TEST_DIRECTORY"/test-terminal.perl "$@" - } - fi + test "$(uname -s)" != Darwin && + + perl "$TEST_DIRECTORY"/test-terminal.perl \ + sh -c "test -t 1 && test -t 2" ' diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index b9d79476e2..f0fbb42554 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -243,40 +243,58 @@ EOF test_line_count = 0 err ' +test_expect_success 'using --git-dir and --work-tree' ' + mkdir unreal real && + git init real && + echo "file test=in-real" >real/.gitattributes && + ( + cd unreal && + attr_check file in-real "--git-dir ../real/.git --work-tree ../real" + ) +' + test_expect_success 'setup bare' ' - git clone --bare . bare.git && - cd bare.git + git clone --bare . bare.git ' test_expect_success 'bare repository: check that .gitattribute is ignored' ' ( - echo "f test=f" - echo "a/i test=a/i" - ) >.gitattributes && - attr_check f unspecified && - attr_check a/f unspecified && - attr_check a/c/f unspecified && - attr_check a/i unspecified && - attr_check subdir/a/i unspecified + cd bare.git && + ( + echo "f test=f" + echo "a/i test=a/i" + ) >.gitattributes && + attr_check f unspecified && + attr_check a/f unspecified && + attr_check a/c/f unspecified && + attr_check a/i unspecified && + attr_check subdir/a/i unspecified + ) ' test_expect_success 'bare repository: check that --cached honors index' ' - GIT_INDEX_FILE=../.git/index \ - git check-attr --cached --stdin --all <../stdin-all | - sort >actual && - test_cmp ../specified-all actual + ( + cd bare.git && + GIT_INDEX_FILE=../.git/index \ + git check-attr --cached --stdin --all <../stdin-all | + sort >actual && + test_cmp ../specified-all actual + ) ' test_expect_success 'bare repository: test info/attributes' ' ( - echo "f test=f" - echo "a/i test=a/i" - ) >info/attributes && - attr_check f f && - attr_check a/f f && - attr_check a/c/f f && - attr_check a/i a/i && - attr_check subdir/a/i unspecified + cd bare.git && + ( + echo "f test=f" + echo "a/i test=a/i" + ) >info/attributes && + attr_check f f && + attr_check a/f f && + attr_check a/c/f f && + attr_check a/i a/i && + attr_check subdir/a/i unspecified + ) ' test_done diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index d730734fde..8c739c9613 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -142,6 +142,20 @@ test_expect_success '> in name is reported' ' grep "error in commit $new" out ' +# date is 2^64 + 1 +test_expect_success 'integer overflow in timestamps is reported' ' + git cat-file commit HEAD >basis && + sed "s/^\\(author .*>\\) [0-9]*/\\1 18446744073709551617/" \ + <basis >bad-timestamp && + new=$(git hash-object -t commit -w --stdin <bad-timestamp) && + test_when_finished "remove_object $new" && + git update-ref refs/heads/bogus "$new" && + test_when_finished "git update-ref -d refs/heads/bogus" && + git fsck 2>out && + cat out && + grep "error in commit $new.*integer overflow" out +' + test_expect_success 'tag pointing to nonexistent' ' cat >invalid-tag <<-\EOF && object ffffffffffffffffffffffffffffffffffffffff diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index 2f96100a5f..82e18548c3 100755 --- a/t/t3030-merge-recursive.sh +++ b/t/t3030-merge-recursive.sh @@ -257,6 +257,7 @@ test_expect_success 'setup 8' ' git add e && test_tick && git commit -m "rename a->e" && + c7=$(git rev-parse --verify HEAD) && git checkout rename-ln && git mv a e && test_ln_s_add e a && @@ -517,6 +518,52 @@ test_expect_success 'reset and bind merge' ' ' +test_expect_success 'merge-recursive w/ empty work tree - ours has rename' ' + ( + GIT_WORK_TREE="$PWD/ours-has-rename-work" && + export GIT_WORK_TREE && + GIT_INDEX_FILE="$PWD/ours-has-rename-index" && + export GIT_INDEX_FILE && + mkdir "$GIT_WORK_TREE" && + git read-tree -i -m $c7 && + git update-index --ignore-missing --refresh && + git merge-recursive $c0 -- $c7 $c3 && + git ls-files -s >actual-files + ) 2>actual-err && + >expected-err && + cat >expected-files <<-EOF && + 100644 $o3 0 b/c + 100644 $o0 0 c + 100644 $o0 0 d/e + 100644 $o0 0 e + EOF + test_cmp expected-files actual-files && + test_cmp expected-err actual-err +' + +test_expect_success 'merge-recursive w/ empty work tree - theirs has rename' ' + ( + GIT_WORK_TREE="$PWD/theirs-has-rename-work" && + export GIT_WORK_TREE && + GIT_INDEX_FILE="$PWD/theirs-has-rename-index" && + export GIT_INDEX_FILE && + mkdir "$GIT_WORK_TREE" && + git read-tree -i -m $c3 && + git update-index --ignore-missing --refresh && + git merge-recursive $c0 -- $c3 $c7 && + git ls-files -s >actual-files + ) 2>actual-err && + >expected-err && + cat >expected-files <<-EOF && + 100644 $o3 0 b/c + 100644 $o0 0 c + 100644 $o0 0 d/e + 100644 $o0 0 e + EOF + test_cmp expected-files actual-files && + test_cmp expected-err actual-err +' + test_expect_success 'merge removes empty directories' ' git reset --hard master && diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh index 9f5659f7fe..2bb973655b 100755 --- a/t/t4010-diff-pathspec.sh +++ b/t/t4010-diff-pathspec.sh @@ -140,4 +140,10 @@ test_expect_success 'diff multiple wildcard pathspecs' ' test_cmp expect actual ' +test_expect_success 'diff-cache ignores trailing slash on submodule path' ' + git diff --name-only HEAD^ submod >expect && + git diff --name-only HEAD^ submod/ >actual && + test_cmp expect actual +' + test_done diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh index bcae35ac1c..044620186d 100755 --- a/t/t4020-diff-external.sh +++ b/t/t4020-diff-external.sh @@ -226,12 +226,13 @@ keep_only_cr () { } test_expect_success 'external diff with autocrlf = true' ' - git config core.autocrlf true && + test_config core.autocrlf true && GIT_EXTERNAL_DIFF=./fake-diff.sh git diff && test $(wc -l < crlfed.txt) = $(cat crlfed.txt | keep_only_cr | wc -c) ' test_expect_success 'diff --cached' ' + test_config core.autocrlf true && git add file && git update-index --assume-unchanged file && echo second >file && @@ -239,4 +240,31 @@ test_expect_success 'diff --cached' ' test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual ' +test_expect_success 'clean up crlf leftovers' ' + git update-index --no-assume-unchanged file && + rm -f file* && + git reset --hard +' + +test_expect_success 'submodule diff' ' + git init sub && + ( cd sub && test_commit sub1 ) && + git add sub && + test_tick && + git commit -m "add submodule" && + ( cd sub && test_commit sub2 ) && + write_script gather_pre_post.sh <<-\EOF && + echo "$1 $4" # path, mode + cat "$2" # old file + cat "$5" # new file + EOF + GIT_EXTERNAL_DIFF=./gather_pre_post.sh git diff >actual && + cat >expected <<-EOF && + sub 160000 + Subproject commit $(git rev-parse HEAD:sub) + Subproject commit $(cd sub && git rev-parse HEAD) + EOF + test_cmp expected actual +' + test_done diff --git a/t/t4035-diff-quiet.sh b/t/t4035-diff-quiet.sh index 231412d100..e8ae2a03fd 100755 --- a/t/t4035-diff-quiet.sh +++ b/t/t4035-diff-quiet.sh @@ -148,4 +148,10 @@ test_expect_success 'git diff --ignore-all-space, both files outside repo' ' ) ' +test_expect_success 'git diff --quiet ignores stat-change only entries' ' + test-chmtime +10 a && + echo modified >>b && + test_expect_code 1 git diff --quiet +' + test_done diff --git a/t/t4212-log-corrupt.sh b/t/t4212-log-corrupt.sh index 93c7c366cf..3fa171541a 100755 --- a/t/t4212-log-corrupt.sh +++ b/t/t4212-log-corrupt.sh @@ -44,4 +44,49 @@ test_expect_success 'git log --format with broken author email' ' test_cmp expect.err actual.err ' +munge_author_date () { + git cat-file commit "$1" >commit.orig && + sed "s/^\(author .*>\) [0-9]*/\1 $2/" <commit.orig >commit.munge && + git hash-object -w -t commit commit.munge +} + +test_expect_success 'unparsable dates produce sentinel value' ' + commit=$(munge_author_date HEAD totally_bogus) && + echo "Date: Thu Jan 1 00:00:00 1970 +0000" >expect && + git log -1 $commit >actual.full && + grep Date <actual.full >actual && + test_cmp expect actual +' + +test_expect_success 'unparsable dates produce sentinel value (%ad)' ' + commit=$(munge_author_date HEAD totally_bogus) && + echo >expect && + git log -1 --format=%ad $commit >actual + test_cmp expect actual +' + +# date is 2^64 + 1 +test_expect_success 'date parser recognizes integer overflow' ' + commit=$(munge_author_date HEAD 18446744073709551617) && + echo "Thu Jan 1 00:00:00 1970 +0000" >expect && + git log -1 --format=%ad $commit >actual && + test_cmp expect actual +' + +# date is 2^64 - 2 +test_expect_success 'date parser recognizes time_t overflow' ' + commit=$(munge_author_date HEAD 18446744073709551614) && + echo "Thu Jan 1 00:00:00 1970 +0000" >expect && + git log -1 --format=%ad $commit >actual && + test_cmp expect actual +' + +# date is within 2^63-1, but enough to choke glibc's gmtime +test_expect_success 'absurdly far-in-future dates produce sentinel' ' + commit=$(munge_author_date HEAD 999999999999999999) && + echo "Thu Jan 1 00:00:00 1970 +0000" >expect && + git log -1 --format=%ad $commit >actual && + test_cmp expect actual +' + test_done diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 926e7f6b97..67e0ab3462 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -536,6 +536,19 @@ test_expect_success 'push with config branch.*.pushremote' ' check_push_result down_repo $the_commit heads/master ' +test_expect_success 'branch.*.pushremote config order is irrelevant' ' + mk_test one_repo heads/master && + mk_test two_repo heads/master && + test_config remote.one.url one_repo && + test_config remote.two.url two_repo && + test_config branch.master.pushremote two_repo && + test_config remote.pushdefault one_repo && + test_config push.default matching && + git push && + check_push_result one_repo $the_first_commit heads/master && + check_push_result two_repo $the_commit heads/master +' + test_expect_success 'push with dry-run' ' mk_test testrepo heads/master && diff --git a/t/t5537-fetch-shallow.sh b/t/t5537-fetch-shallow.sh index b0fa7387cb..3ae9092f5c 100755 --- a/t/t5537-fetch-shallow.sh +++ b/t/t5537-fetch-shallow.sh @@ -173,32 +173,4 @@ EOF ) ' -if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then - say 'skipping remaining tests, git built without http support' - test_done -fi - -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5537'} -. "$TEST_DIRECTORY"/lib-httpd.sh -start_httpd - -test_expect_success 'clone http repository' ' - git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && - git clone $HTTPD_URL/smart/repo.git clone && - ( - cd clone && - git fsck && - git log --format=%s origin/master >actual && - cat <<EOF >expect && -7 -6 -5 -4 -3 -EOF - test_cmp expect actual - ) -' - -stop_httpd test_done diff --git a/t/t5538-push-shallow.sh b/t/t5538-push-shallow.sh index 0a6e40f144..8e54ac5746 100755 --- a/t/t5538-push-shallow.sh +++ b/t/t5538-push-shallow.sh @@ -126,7 +126,6 @@ if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then test_done fi -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5537'} . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd diff --git a/t/t5539-fetch-http-shallow.sh b/t/t5539-fetch-http-shallow.sh new file mode 100755 index 0000000000..94553e1039 --- /dev/null +++ b/t/t5539-fetch-http-shallow.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +test_description='fetch/clone from a shallow clone over http' + +. ./test-lib.sh + +if test -n "$NO_CURL"; then + skip_all='skipping test, git built without http support' + test_done +fi + +. "$TEST_DIRECTORY"/lib-httpd.sh +start_httpd + +commit() { + echo "$1" >tracked && + git add tracked && + git commit -m "$1" +} + +test_expect_success 'setup shallow clone' ' + commit 1 && + commit 2 && + commit 3 && + commit 4 && + commit 5 && + commit 6 && + commit 7 && + git clone --no-local --depth=5 .git shallow && + git config --global transfer.fsckObjects true +' + +test_expect_success 'clone http repository' ' + git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && + git clone $HTTPD_URL/smart/repo.git clone && + ( + cd clone && + git fsck && + git log --format=%s origin/master >actual && + cat <<EOF >expect && +7 +6 +5 +4 +3 +EOF + test_cmp expect actual + ) +' + +# This test is tricky. We need large enough "have"s that fetch-pack +# will put pkt-flush in between. Then we need a "have" the server +# does not have, it'll send "ACK %s ready" +test_expect_success 'no shallow lines after receiving ACK ready' ' + ( + cd shallow && + for i in $(test_seq 15) + do + git checkout --orphan unrelated$i && + test_commit unrelated$i && + git push -q "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \ + refs/heads/unrelated$i:refs/heads/unrelated$i && + git push -q ../clone/.git \ + refs/heads/unrelated$i:refs/heads/unrelated$i || + exit 1 + done && + git checkout master && + test_commit new && + git push "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" master + ) && + ( + cd clone && + git checkout --orphan newnew && + test_commit new-too && + GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" git fetch --depth=2 && + grep "fetch-pack< ACK .* ready" ../trace && + ! grep "fetch-pack> done" ../trace + ) +' + +stop_httpd +test_done diff --git a/t/t5540-http-push.sh b/t/t5540-http-push-webdav.sh index 5b0198cbc8..8d7b3c57e3 100755 --- a/t/t5540-http-push.sh +++ b/t/t5540-http-push-webdav.sh @@ -16,7 +16,6 @@ then fi LIB_HTTPD_DAV=t -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'} . "$TEST_DIRECTORY"/lib-httpd.sh ROOT_PATH="$PWD" start_httpd diff --git a/t/t5541-http-push.sh b/t/t5541-http-push-smart.sh index bfd241ea8a..73af16f481 100755 --- a/t/t5541-http-push.sh +++ b/t/t5541-http-push-smart.sh @@ -12,7 +12,6 @@ if test -n "$NO_CURL"; then fi ROOT_PATH="$PWD" -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5541'} . "$TEST_DIRECTORY"/lib-httpd.sh . "$TEST_DIRECTORY"/lib-terminal.sh start_httpd diff --git a/t/t5550-http-fetch.sh b/t/t5550-http-fetch-dumb.sh index 8392624714..1a3a2b6c1a 100755 --- a/t/t5550-http-fetch.sh +++ b/t/t5550-http-fetch-dumb.sh @@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then test_done fi -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5550'} . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch-smart.sh index a124efe114..e07eaf35f1 100755 --- a/t/t5551-http-fetch.sh +++ b/t/t5551-http-fetch-smart.sh @@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then test_done fi -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5551'} . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd diff --git a/t/t5561-http-backend.sh b/t/t5561-http-backend.sh index b5d7fbc381..d23fb02384 100755 --- a/t/t5561-http-backend.sh +++ b/t/t5561-http-backend.sh @@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then test_done fi -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5561'} . "$TEST_DIRECTORY"/lib-httpd.sh start_httpd diff --git a/t/t6131-pathspec-icase.sh b/t/t6131-pathspec-icase.sh index a7c7ff5f49..39fc3f6769 100755 --- a/t/t6131-pathspec-icase.sh +++ b/t/t6131-pathspec-icase.sh @@ -69,7 +69,7 @@ test_expect_success 'tree_entry_interesting matches :(icase)bar with empty prefi test_cmp expect actual ' -test_expect_success 'match_pathspec_depth matches :(icase)bar' ' +test_expect_success 'match_pathspec matches :(icase)bar' ' cat <<-EOF >expect && BAR bAr @@ -79,7 +79,7 @@ test_expect_success 'match_pathspec_depth matches :(icase)bar' ' test_cmp expect actual ' -test_expect_success 'match_pathspec_depth matches :(icase)bar with prefix' ' +test_expect_success 'match_pathspec matches :(icase)bar with prefix' ' cat <<-EOF >expect && fOo/BAR fOo/bAr @@ -89,7 +89,7 @@ test_expect_success 'match_pathspec_depth matches :(icase)bar with prefix' ' test_cmp expect actual ' -test_expect_success 'match_pathspec_depth matches :(icase)bar with empty prefix' ' +test_expect_success 'match_pathspec matches :(icase)bar with empty prefix' ' cat <<-EOF >expect && bar fOo/BAR diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index e3c8c2c1b8..215d43d6a6 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -294,7 +294,8 @@ test_expect_success 'setup submodule' ' git submodule add ./. sub && echo content >file && git add file && - git commit -m "added sub and file" + git commit -m "added sub and file" && + git branch submodule ' test_expect_success 'git mv cannot move a submodule in a file' ' @@ -463,4 +464,14 @@ test_expect_success 'checking out a commit before submodule moved needs manual u ! test -s actual ' +test_expect_success 'mv -k does not accidentally destroy submodules' ' + git checkout submodule && + mkdir dummy dest && + git mv -k dummy sub dest && + git status --porcelain >actual && + grep "^R sub -> dest/sub" actual && + git reset --hard && + git checkout . +' + test_done diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh index 7d467c034a..741ec08576 100755 --- a/t/t7060-wtstatus.sh +++ b/t/t7060-wtstatus.sh @@ -38,7 +38,7 @@ You have unmerged paths. Unmerged paths: (use "git add/rm <file>..." as appropriate to mark resolution) - deleted by us: foo + deleted by us: foo no changes added to commit (use "git add" and/or "git commit -a") EOF @@ -142,8 +142,8 @@ You have unmerged paths. Unmerged paths: (use "git add/rm <file>..." as appropriate to mark resolution) - both added: conflict.txt - deleted by them: main.txt + both added: conflict.txt + deleted by them: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF @@ -175,9 +175,9 @@ You have unmerged paths. Unmerged paths: (use "git add/rm <file>..." as appropriate to mark resolution) - both deleted: main.txt - added by them: sub_master.txt - added by us: sub_second.txt + both deleted: main.txt + added by them: sub_master.txt + added by us: sub_second.txt no changes added to commit (use "git add" and/or "git commit -a") EOF @@ -203,7 +203,7 @@ Changes to be committed: Unmerged paths: (use "git rm <file>..." to mark resolution) - both deleted: main.txt + both deleted: main.txt Untracked files not listed (use -u option to show untracked files) EOF diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 8d4b50d1b5..ee117e2e72 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -535,4 +535,15 @@ test_expect_success 'reset with paths accepts tree' ' git diff HEAD --exit-code ' +test_expect_success 'reset --mixed sets up work tree' ' + git init mixed_worktree && + ( + cd mixed_worktree && + test_commit dummy + ) && + : >expect && + git --git-dir=mixed_worktree/.git --work-tree=mixed_worktree reset >actual && + test_cmp expect actual +' + test_done diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 710be90489..74de814aec 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -511,4 +511,20 @@ test_expect_success SANITY 'git clean -d with an unreadable empty directory' ' ! test -d foo ' +test_expect_success 'git clean -d respects pathspecs (dir is prefix of pathspec)' ' + mkdir -p foo && + mkdir -p foobar && + git clean -df foobar && + test_path_is_dir foo && + test_path_is_missing foobar +' + +test_expect_success 'git clean -d respects pathspecs (pathspec is prefix of dir)' ' + mkdir -p foo && + mkdir -p foobar && + git clean -df foo && + test_path_is_missing foo && + test_path_is_dir foobar +' + test_done diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh index 3cec57af1e..68ad2d7454 100755 --- a/t/t7512-status-help.sh +++ b/t/t7512-status-help.sh @@ -33,7 +33,7 @@ You have unmerged paths. Unmerged paths: (use "git add <file>..." to mark resolution) - both modified: main.txt + both modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF @@ -87,7 +87,7 @@ Unmerged paths: (use "git reset HEAD <file>..." to unstage) (use "git add <file>..." to mark resolution) - both modified: main.txt + both modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF @@ -146,7 +146,7 @@ Unmerged paths: (use "git reset HEAD <file>..." to unstage) (use "git add <file>..." to mark resolution) - both modified: main.txt + both modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF @@ -602,7 +602,7 @@ rebase in progress; onto $ONTO You are currently rebasing branch '\''statushints_disabled'\'' on '\''$ONTO'\''. Unmerged paths: - both modified: main.txt + both modified: main.txt no changes added to commit EOF @@ -636,7 +636,7 @@ You are currently cherry-picking commit $TO_CHERRY_PICK. Unmerged paths: (use "git add <file>..." to mark resolution) - both modified: main.txt + both modified: main.txt no changes added to commit (use "git add" and/or "git commit -a") EOF @@ -707,7 +707,7 @@ Unmerged paths: (use "git reset HEAD <file>..." to unstage) (use "git add <file>..." to mark resolution) - both modified: to-revert.txt + both modified: to-revert.txt no changes added to commit (use "git add" and/or "git commit -a") EOF diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index 2418528487..5a193c500d 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -434,4 +434,18 @@ test_expect_success PERL 'difftool --no-symlinks detects conflict ' ' ) ' +test_expect_success PERL 'difftool properly honors gitlink and core.worktree' ' + git submodule add ./. submod/ule && + ( + cd submod/ule && + test_config diff.tool checktrees && + test_config difftool.checktrees.cmd '\'' + test -d "$LOCAL" && test -d "$REMOTE" && echo good + '\'' && + echo good >expect && + git difftool --tool=checktrees --dir-diff HEAD~ >actual && + test_cmp expect actual + ) +' + test_done diff --git a/t/test-lib.sh b/t/test-lib.sh index 1531c241c0..3c7cb1d774 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -277,7 +277,7 @@ error "Test script did not set test_description." if test "$help" = "t" then - echo "$test_description" + printf '%s\n' "$test_description" exit 0 fi @@ -328,7 +328,7 @@ test_failure_ () { test_failure=$(($test_failure + 1)) say_color error "not ok $test_count - $1" shift - echo "$@" | sed -e 's/^/# /' + printf '%s\n' "$*" | sed -e 's/^/# /' test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; } } |