3 # Copyright (c) 2005 Junio C Hamano
6 test_description='general environment name warning test.
8 This test makes sure that use of deprecated environment variables
9 trigger the warnings from gitenv().'
11 env_vars='GIT_AUTHOR_DATE:AUTHOR_DATE
12 GIT_AUTHOR_EMAIL:AUTHOR_EMAIL
13 GIT_AUTHOR_NAME:AUTHOR_NAME
14 GIT_COMMITTER_EMAIL:COMMIT_AUTHOR_EMAIL
15 GIT_COMMITTER_NAME:COMMIT_AUTHOR_NAME
16 GIT_ALTERNATE_OBJECT_DIRECTORIES:SHA1_FILE_DIRECTORIES
17 GIT_OBJECT_DIRECTORY:SHA1_FILE_DIRECTORY
25 new=$(expr "$ev" : '\(.*\):')
26 old=$(expr "$ev" : '.*:\(.*\)')
27 # Build and eval the following:
28 # case "${VAR+set}" in set) export VAR;; esac
29 evstr='case "${'$new'+set}" in set) export '$new';; esac'
31 evstr='case "${'$old'+set}" in set) export '$old';; esac'
37 git-update-cache --add path0
38 tree=$(git-write-tree)
40 AUTHOR_DATE='Wed May 11 23:55:18 2005'
41 AUTHOR_EMAIL='author@example.xz'
42 AUTHOR_NAME='A U Thor'
43 COMMIT_AUTHOR_EMAIL='author@example.xz'
44 COMMIT_AUTHOR_NAME='A U Thor'
45 SHA1_FILE_DIRECTORY=.git/objects
49 echo 'foo' | git-commit-tree $tree >/dev/null 2>errmsg
50 cat >expected-err <<\EOF
51 warning: Attempting to use SHA1_FILE_DIRECTORY
52 warning: GIT environment variables have been renamed.
53 warning: Please adjust your scripts and environment.
54 warning: old AUTHOR_DATE => new GIT_AUTHOR_DATE
55 warning: old AUTHOR_EMAIL => new GIT_AUTHOR_EMAIL
56 warning: old AUTHOR_NAME => new GIT_AUTHOR_NAME
57 warning: old COMMIT_AUTHOR_EMAIL => new GIT_COMMITTER_EMAIL
58 warning: old COMMIT_AUTHOR_NAME => new GIT_COMMITTER_NAME
59 warning: old SHA1_FILE_DIRECTORY => new GIT_OBJECT_DIRECTORY
61 sed -ne '/^warning: /p' <errmsg >generated-err
64 'using old names should issue warnings.' \
65 'cmp generated-err expected-err'
69 new=$(expr "$ev" : '\(.*\):')
70 old=$(expr "$ev" : '.*:\(.*\)')
71 # Build and eval the following:
77 echo 'foo' | git-commit-tree $tree >/dev/null 2>errmsg
78 sed -ne '/^warning: /p' <errmsg >generated-err
81 'using old names but having new names should not issue warnings.' \
82 'cmp generated-err /dev/null'