The core GIT tests: recent additions and fixes.
PATCH 2/2 The core GIT tests: recent additions and fixes.
This set of scripts are designed to test the features and fixes we recently added to core GIT. The convention to call test helper function has been changed during the framework cleanup (take two), and these tests have been updated to use the cleaned up test-lib.sh interface.
Note that the last test, t2000-diff.sh, assumes that we updated the built-in diff driver with the mode change bits normalization patch I sent earlier.
---
t/t0100-environment-names.sh | 84 ++++++++++++++++++++++++++++++++++++++++ t/t0200-update-cache.sh | 51 ++++++++++++++++++++++++ t/t0400-ls-files.sh | 33 +++++++++++++++ t/t0500-ls-files.sh | 61 +++++++++++++++++++++++++++++ t/t1000-checkout-cache.sh | 56 ++++++++++++++++++++++++++ t/t1001-checkout-cache.sh | 90 +++++++++++++++++++++++++++++++++++++++++++ t/t2000-diff.sh | 50 +++++++++++++++++++++++ 7 files changed, 425 insertions(+)
t/t0100-environment-names.sh (. --> 100755)t/t0200-update-cache.sh (. --> 100755)t/t0400-ls-files.sh (. --> 100755)t/t0500-ls-files.sh (. --> 100755)t/t1000-checkout-cache.sh (. --> 100755)t/t1001-checkout-cache.sh (. --> 100755)t/t2000-diff.sh (. --> 100755)
t/t0100-environment-names.sh +84 -0
@@ -0,0 +1,84 @@ +#!/bin/sh +# +# Copyright (c) 2005 Junio C Hamano +# + +test_description='general environment name warning test. + +This test makes sure that use of deprecated environment variables +trigger the warnings from gitenv().' + +env_vars='GIT_AUTHOR_DATE:AUTHOR_DATE +GIT_AUTHOR_EMAIL:AUTHOR_EMAIL +GIT_AUTHOR_NAME:AUTHOR_NAME +GIT_COMMITTER_EMAIL:COMMIT_AUTHOR_EMAIL +GIT_COMMITTER_NAME:COMMIT_AUTHOR_NAME +GIT_ALTERNATE_OBJECT_DIRECTORIES:SHA1_FILE_DIRECTORIES +GIT_OBJECT_DIRECTORY:SHA1_FILE_DIRECTORY +' + +. ./test-lib.sh + +export_them () { + for ev in $env_vars + do + new=$(expr "$ev" : '\(.*\):') + old=$(expr "$ev" : '.*:\(.*\)') + # Build and eval the following: + # case "${VAR+set}" in set) export VAR;; esac + evstr='case "${'$new'+set}" in set) export '$new';; esac' + eval "$evstr" + evstr='case "${'$old'+set}" in set) export '$old';; esac' + eval "$evstr" + done +} + +date >path0 +git-update-cache --add path0 +tree=$(git-write-tree) + +AUTHOR_DATE='Wed May 11 23:55:18 2005' +AUTHOR_EMAIL='[email protected]' +AUTHOR_NAME='A U Thor' +COMMIT_AUTHOR_EMAIL='[email protected]' +COMMIT_AUTHOR_NAME='A U Thor' +SHA1_FILE_DIRECTORY=.git/objects + +export_them + +echo 'foo' | git-commit-tree $tree >/dev/null 2>errmsg +cat >expected-err <<\EOF +warning: Attempting to use SHA1_FILE_DIRECTORY +warning: GIT environment variables have been renamed. +warning: Please adjust your scripts and environment. +warning: old AUTHOR_DATE => new GIT_AUTHOR_DATE +warning: old AUTHOR_EMAIL => new GIT_AUTHOR_EMAIL +warning: old AUTHOR_NAME => new GIT_AUTHOR_NAME +warning: old COMMIT_AUTHOR_EMAIL => new GIT_COMMITTER_EMAIL +warning: old COMMIT_AUTHOR_NAME => new GIT_COMMITTER_NAME +warning: old SHA1_FILE_DIRECTORY => new GIT_OBJECT_DIRECTORY +EOF +sed -ne '/^warning: /p' <errmsg >generated-err + +test_expect_success \ + 'using old names should issue warnings.' \ + 'cmp generated-err expected-err' + +for ev in $env_vars +do + new=$(expr "$ev" : '\(.*\):') + old=$(expr "$ev" : '.*:\(.*\)') + # Build and eval the following: + # NEWENV=$OLDENV + evstr="$new=\$$old" + eval "$evstr" +done +export_them +echo 'foo' | git-commit-tree $tree >/dev/null 2>errmsg +sed -ne '/^warning: /p' <errmsg >generated-err + +test_expect_success \ + 'using old names but having new names should not issue warnings.' \ + 'cmp generated-err /dev/null' + +test_done
t/t0200-update-cache.sh +51 -0
51 lines not on this page · raw message
t/t0400-ls-files.sh +33 -0
@@ -0,0 +1,33 @@ +#!/bin/sh +# +# Copyright (c) 2005 Junio C Hamano +# + +test_description='git-ls-files test (--others should pick up symlinks). + +This test runs git-ls-files --others with the following on the +filesystem. + + path0 - a file + path1 - a symlink + path2/file2 - a file in a directory +' +. ./test-lib.sh + +date >path0 +ln -s xyzzy path1 +mkdir path2 +date >path2/file2 +test_expect_success \ + 'git-ls-files --others to show output.' \ + 'git-ls-files --others >.output' +cat >.expected <<EOF +path0 +path1 +path2/file2 +EOF + +test_expect_success \ + 'git-ls-files --others should pick up symlinks.' \ + 'diff .output .expected' +test_done
t/t0500-ls-files.sh +61 -0
61 lines not on this page · raw message
t/t1000-checkout-cache.sh +56 -0
56 lines not on this page · raw message
t/t1001-checkout-cache.sh +90 -0
90 lines not on this page · raw message
t/t2000-diff.sh +50 -0
50 lines not on this page · raw message