1#!/bin/sh
2#
3# Copyright (c) 2012 Valentin Duperray, Lucien Kong, Franck Jonas,
4# Thomas Nguy, Khoi Nguyen
5# Grenoble INP Ensimag
6#
78
test_description='Compatibility with $XDG_CONFIG_HOME/git/ files'
910
. ./test-lib.sh
1112
test_expect_success 'read config: xdg file exists and ~/.gitconfig doesn'\''t' '
13mkdir -p .config/git &&
14echo "[alias]" >.config/git/config &&
15echo " myalias = !echo in_config" >>.config/git/config &&
16echo in_config >expected &&
17git myalias >actual &&
18test_cmp expected actual
19'
2021
22
test_expect_success 'read config: xdg file exists and ~/.gitconfig exists' '
23>.gitconfig &&
24echo "[alias]" >.gitconfig &&
25echo " myalias = !echo in_gitconfig" >>.gitconfig &&
26echo in_gitconfig >expected &&
27git myalias >actual &&
28test_cmp expected actual
29'
3031
32
test_expect_success 'read with --get: xdg file exists and ~/.gitconfig doesn'\''t' '
33rm .gitconfig &&
34echo "[user]" >.config/git/config &&
35echo " name = read_config" >>.config/git/config &&
36echo read_config >expected &&
37git config --get user.name >actual &&
38test_cmp expected actual
39'
4041
42
test_expect_success 'read with --get: xdg file exists and ~/.gitconfig exists' '
43>.gitconfig &&
44echo "[user]" >.gitconfig &&
45echo " name = read_gitconfig" >>.gitconfig &&
46echo read_gitconfig >expected &&
47git config --get user.name >actual &&
48test_cmp expected actual
49'
5051
52
test_expect_success 'read with --list: xdg file exists and ~/.gitconfig doesn'\''t' '
53rm .gitconfig &&
54echo user.name=read_config >expected &&
55git config --global --list >actual &&
56test_cmp expected actual
57'
5859
60
test_expect_success 'read with --list: xdg file exists and ~/.gitconfig exists' '
61>.gitconfig &&
62echo "[user]" >.gitconfig &&
63echo " name = read_gitconfig" >>.gitconfig &&
64echo user.name=read_gitconfig >expected &&
65git config --global --list >actual &&
66test_cmp expected actual
67'
6869
70
test_done