There are 4 tests: test1 and test2: read tests test1: ~/.config/git/config exists and ~/.gitconfig doesn't git reads ~/.config/git/config test2: ~/.config/git/config exists and ~/.gitconfig exists git reads ~/.gitconfig test3 and test4: write tests test3: ~/.config/git/config exists and ~/.gitconfig doesn't git writes in ~/.config/git/config test4: ~/.config/git/config exists and ~/.gitconfig exists git writes in ~/.gitconfig --- t/t1306-second-config-file.sh | 47 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-) create mode 100755 t/t1306-second-config-file.sh diff --git a/t/t1306-second-config-file.sh b/t/t1306-second-config-file.sh new file mode 100755 index 0000000..5406456 --- /dev/null +++ b/t/t1306-second-config-file.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Copyright (c) 2012 Valentin Duperray, Lucien Kong, Franck Jonas, +# Thomas Nguy, Khoi Nguyen +# Grenoble INP Ensimag +# + +test_description='~/.config/git/config instead of ~/.gitconfig' + +. ./test-lib.sh + +test_expect_success 'read: ~/.config/git/config exists and ~/.gitconfig doesn'\''t' ' + mkdir .config && + mkdir .config/git && + echo "[user]" >.config/git/config && + echo " name = read_config" >>.config/git/config && + echo read_config >expect && + git config --global --get user.name >output && + test_cmp expect output +' + +test_expect_success 'read: ~/.config/git/config exists and ~/.gitconfig exists' ' + >.gitconfig && + echo "[user]" >.gitconfig && + echo " name = read_gitconfig" >>.gitconfig && + echo read_gitconfig >expect && + git config --global --get user.name >output && + test_cmp expect output +' + +test_expect_success 'write: ~/.config/git/config exists and ~/.gitconfig doesn'\''t' ' + rm .gitconfig && + git config --global user.name "write_config" && + echo "[user]" >expect && + echo " name = write_config" >>expect && + test_cmp expect .config/git/config +' + +test_expect_success 'write: ~/.config/git/config exists and ~/.gitconfig exists' ' + >.gitconfig && + git config --global user.name "write_gitconfig" && + echo "[user]" >expect && + echo " name = write_gitconfig" >>expect && + test_cmp expect .gitconfig +' + +test_done -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html