From: Junio C Hamano Date: Wed, 3 Apr 2013 16:25:15 +0000 (-0700) Subject: Merge branch 'jk/empty-archive' into maint X-Git-Tag: v1.8.2.1~14 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a9dc3b64814f6fd1b978f10c6565bedae5965ad9?hp=-c Merge branch 'jk/empty-archive' into maint "git archive" reports a failure when asked to create an archive out of an empty tree. It would be more intuitive to give an empty archive back in such a case. * jk/empty-archive: archive: handle commits with an empty tree test-lib: factor out $GIT_UNZIP setup --- a9dc3b64814f6fd1b978f10c6565bedae5965ad9 diff --combined t/t5003-archive-zip.sh index 6a33606d28,0f5b42b8ed..4e7b05dd23 --- a/t/t5003-archive-zip.sh +++ b/t/t5003-archive-zip.sh @@@ -3,15 -3,9 +3,9 @@@ test_description='git archive --format=zip test' . ./test-lib.sh - GIT_UNZIP=${GIT_UNZIP:-unzip} SUBSTFORMAT=%H%n - test_lazy_prereq UNZIP ' - "$GIT_UNZIP" -v - test $? -ne 127 - ' - test_lazy_prereq UNZIP_SYMLINKS ' ( mkdir unzip-symlinks && @@@ -76,12 -70,6 +70,12 @@@ test_expect_success git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \ git commit-tree $treeid >.git/info/attributes && + git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \ + >a/substfile1 +' + test_expect_success \ 'create bare clone' \ 'git clone --bare . bare.git && diff --combined t/test-lib.sh index 9e7f6b424d,e20fc69922..1f510252ad --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -214,13 -214,11 +214,13 @@@ the error) tput bold; tput setaf 1;; # bold red skip) - tput bold; tput setaf 2;; # bold green + tput setaf 4;; # blue + warn) + tput setaf 3;; # brown/yellow pass) - tput setaf 2;; # green + tput setaf 2;; # green info) - tput setaf 3;; # brown + tput setaf 6;; # cyan *) test -n "$quiet" && return;; esac @@@ -302,7 -300,7 +302,7 @@@ test_ok_ () test_failure_ () { test_failure=$(($test_failure + 1)) - say_color error "not ok - $test_count $1" + say_color error "not ok $test_count - $1" shift echo "$@" | sed -e 's/^/# /' test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; } @@@ -310,12 -308,12 +310,12 @@@ test_known_broken_ok_ () { test_fixed=$(($test_fixed+1)) - say_color "" "ok $test_count - $@ # TODO known breakage" + say_color error "ok $test_count - $@ # TODO known breakage vanished" } test_known_broken_failure_ () { test_broken=$(($test_broken+1)) - say_color skip "not ok $test_count - $@ # TODO known breakage" + say_color warn "not ok $test_count - $@ # TODO known breakage" } test_debug () { @@@ -408,18 -406,13 +408,18 @@@ test_done () if test "$test_fixed" != 0 then - say_color pass "# fixed $test_fixed known breakage(s)" + say_color error "# $test_fixed known breakage(s) vanished; please update test(s)" fi if test "$test_broken" != 0 then - say_color error "# still have $test_broken known breakage(s)" - msg="remaining $(($test_count-$test_broken)) test(s)" + say_color warn "# still have $test_broken known breakage(s)" + fi + if test "$test_broken" != 0 || test "$test_fixed" != 0 + then + test_remaining=$(( $test_count - $test_broken - $test_fixed )) + msg="remaining $test_remaining test(s)" else + test_remaining=$test_count msg="$test_count test(s)" fi case "$test_failure" in @@@ -433,7 -426,7 +433,7 @@@ if test $test_external_has_tap -eq 0 then - if test $test_count -gt 0 + if test $test_remaining -gt 0 then say_color pass "# passed all $msg" fi @@@ -624,7 -617,7 +624,7 @@@ for skp in $GIT_SKIP_TEST do case "$this_test" in $skp) - say_color skip >&3 "skipping test $this_test altogether" + say_color info >&3 "skipping test $this_test altogether" skip_all="skip all tests in $this_test" test_done esac @@@ -666,14 -659,12 +666,14 @@@ case $(uname -s) i # backslashes in pathspec are converted to '/' # exec does not inherit the PID test_set_prereq MINGW + test_set_prereq NOT_CYGWIN test_set_prereq SED_STRIPS_CR ;; *CYGWIN*) test_set_prereq POSIXPERM test_set_prereq EXECKEEPSPID test_set_prereq NOT_MINGW + test_set_prereq CYGWIN test_set_prereq SED_STRIPS_CR ;; *) @@@ -681,7 -672,6 +681,7 @@@ test_set_prereq BSLASHPSPEC test_set_prereq EXECKEEPSPID test_set_prereq NOT_MINGW + test_set_prereq NOT_CYGWIN ;; esac @@@ -760,3 -750,9 +760,9 @@@ test_lazy_prereq AUTOIDENT # When the tests are run as root, permission tests will report that # things are writable when they shouldn't be. test -w / || test_set_prereq SANITY + + GIT_UNZIP=${GIT_UNZIP:-unzip} + test_lazy_prereq UNZIP ' + "$GIT_UNZIP" -v + test $? -ne 127 + '